Open awilkins opened 6 years ago
Thanks for reporting!
we just ran into this on a giant merge conflict! 😱
It might be good to either a) disable the undo button if the last commit is a merge commit and or b) prompt for confirmation and suggest amending instead.
In case anyone else runs into this in the meantime: you can use git reflog
on the command line to find the merge commit before undoing, and reset hard to it.
Description
Using the commit undo feature when the last commit is a merge commit breaks the principle of least surprise, and does not leave you in the state you were at before the commit (in an uncommitted merge).
Steps to Reproduce
Expected behavior:
Last commit in the graph has two ancestors, the previous head revisions of
master
andfeature
. It is a normal merge commit.Actual behavior:
Last commit in the graph is now the equivalent of a cherry-pick of the diff from
master
into yourfeature
branch. This commit only has one ancestor, the previous head offeature
.Reproduces how often:
Always
Versions
Ubuntu 16.04