I've accidently did git commit --amend
on the last commit on the tree (which is not written by me ) and I would like to undo this commit
and retrieve my changes back to the working directory.
I'm familiar with the fact the --commit amend
is part of "Rewriting History" Git commands but I hope there is a workaround via author name or any other.
答案 0 :(得分:2)
Yes, there is a way to recover your state prior to the amend.
Go to the working copy and run git reflog
, find the hash of the commit prior to the amend and do a git reset to it. You are done ;)
Duplicate of: How to undo "git commit --amend" done instead of "git commit"