How to revert changes I made with merging two branches
I have two branches develop
and personal
. I use GitExtensions
tool. I was working in d开发者_如何学运维evelop
branch and then I needed to merge it with personal
. I launched merging, the tool notified me there are some conflicts (different name of packages) and proposed to resolve conflicts using mergetool
. But mergetool
wasn't opened as usual but I got the message all conflict resolved, I was expecting to resolve them manually. Of course this accidentally (?) happened merging was incorrect and I tried to revert these changes by Reset current branch to here
and chosen my previous commit. Unfortunately changes made were reverted (which is ok) but name of folders (my packages in android platform) didn't. I tried to revert changes by checkout
and reset
but I can't get the snapshot of file system when everything was ok. I'm very new to git
, please advice how to resolve this problem.
Did you do a hard
reset? In git extensions you tick the checkbox that says hard
If you reset your branch to a commit before the changes, everything should have reset to to exactly what was in your repository at that commit. If you're saying folder names are not correct, are you sure they were being tracked at that point in time? You can find out if they are being tracked at that time by running git ls-files
If they are being tracked at the time, try running git reset --hard
, after you reset back to that point. Any unsaved changes you have to tracked files will be lost forever when you do this, so make sure you have everything committed, or git stash
your changes.
Checkout the branch you want to revert then using git log get the hash of a commit corresponding to the state you want. Then you may use git reset HASH or git chevkout HASH to revert to that commit
精彩评论