Here’s a quick walkthrough of my own process. I’ve often amended a commit like this:
shell> echo "bar" >> a
shell> git commit -a -m "made a bar"
shell echo "baz" >> a
shell> git commit --amend -C HEAD -a
Only to notice it was a whoops! I may have noticed it right away or noticed it after pushing, or noticed it the next day. So, I’ll run git reflog
:
shell> git reflog