Undo git fast forward merge Undo git fast forward merge git git

Undo git fast forward merge


git reflog show testBranch

should show the Fast-forward merge as last item ({0}).After making sure this is the case, checkout testBranch and then just do

git reset --keep testBranch@{1}

to revert to the previous state.


If you know of a revision in which you want your local testBranch, it is as simple as:

git checkout testBranchgit reset --hard <revision>

If you have changes mixed in like (oldest on top):

<point><your_change_a><change_from_someone_else><your_change_b><testBranch>

You could:

git checkout testBranchgit reset --hard <point>git cherry-pick <your_change_a>git cherry-pick <your_change_b>