![]() At that point, I could get rid of that commit, turning it into unstaged changes: git reset HEAD^ There might be merge conflicts, which would have to be resolved, since the previously unstaged wanted changes might have depended on the staged unwanted changes.Īt the end, I would have a single commit which has just the changes that were previously unstaged, and the unwanted changes are gone. In the editor window that comes up, I would simply delete the commit which holds the unwanted changes that came from the unwanted index, and then save and quit, letting the interactive rebase do the rest. Git rebase -interactive HEAD^^ # rebase top two commits onto same branch ![]() Git commit -a # commit the remaining changes In that case, what I would do would be to use interactive rebase to splice the changes out: git commit # commit the index The end effect is exactly like squirreling away the results of git diff HEAD, rolling everything back to the topmost commit, and then re-applying that diff to HEAD to re-create the original work tree.īut suppose you want to throw away the changes from the index such that these discarded changes are actually subtracted from your work. This is equivalent to your self answer, "using git commands only". ![]() To discard the index without touching the working tree, you can just do this: git reset
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |