I am trying to revert a faulty merge, but the revert changes from both commands do not look right.
This is how I made the merge commit:
# merge master into branch:
git checkout branch
git merge master
# resolve conflicts
git commit
git push
Now I want to revert that merge with:
git log b2e
commit b2e...
Merge: de9... cf4...
git revert -m 1 -n b2e
The problem is that git status
shows that it will only undo the conflicts I resolved, and not the entire merge.
The command git revert -m 2 -n b2e
will undo changes made to the branch before the merge, which I don't want either.
Second question is: How do I show what was changed in a merge commit?
git show b2e # only shows the conflicts I resolved
git diff b2e de9 # does the same
git diff b2e cf4 # shows what is different between the branch and master
Update: The de9
commit was the right one to revert to and git diff b2e de9 does show what was committed. One reason I was confused was because a delete/keep conflict didn't show in the diff, so I thought there were changes git wasn't showing me. diff'ing to cf4
, the commit from master
, confused me even more because I didn't quite understand what was going on.
There is no need to answer this question.