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.
More on Undoing changes: reset, revert, restore and reflog
What are the three modes of `git reset`?BeginnerWhat is the difference between `git reset` and `git revert`?BeginnerHow do you discard changes in one file?BeginnerHow do you recover a commit after `git reset --hard`?IntermediateCan you recover uncommitted changes lost by `git reset --hard` or `git checkout .`?IntermediateHow do you undo `git add` for a file?Beginner