3

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.

Nir Duan
  • 6,164
  • 4
  • 24
  • 38

1 Answers1

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"

Community
  • 1
  • 1
Kalecser
  • 1,143
  • 12
  • 15