Undoing a git commit –amend
In order to undo a git commit --amend
, take a look at the git reflog
. HEAD@{1}
will contain the commit just before the amend (assuming that the amend was made just now). So, reset to HEAD@{1}
softly. This will make the erroneous amendment show up in the staging area. Then, you can commit it separately, with git commit -C HEAD@{1}
, for example. Note that after resetting, the reflog has changed so that HEAD@{1}
is now pointing to the amended commit. Take a look at this link.
Leave a Comment