Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

What does `git commit --amend` do to the reflog and to the old commit?

IntermediateConceptUndoing changes: reset, revert, restore and reflog
Answer

It creates a new commit replacing the tip, and the old one becomes unreachable but stays in the reflog until expiry. If you already pushed, the remote will reject a normal push and you must use --force-with-lease.

All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog