Cheatsheet Pages / Git Cheatsheet
How to fix the last Git commit — git commit --amend
You just committed and immediately spot a typo in the message or a file you forgot to include.
git commit -m "Add login validation" # normal commit
git commit --amend --no-edit # fold new staged changes into the last commit
Good to know
--amend rewrites the most recent commit instead of adding a new one. Warning: don't amend commits already pushed.
