When we are working, we make a lot of commits. Sometimes we just forget something obvious that we want to fix quickly.
git commit --amend allows us to do that - tinker with the last commit we made.
You can use git log -p or git show to inspect the contents of commits and file changes that were added to the commits.
- Run
source setup.sh(or.\setup.ps1in PowerShell)
- What does
git statustell us? - What does
git log -ptell us? - Stage the addition of bar.txt
- Run
git commit --amend - What happened? What does
git log -ptell us? - What happens if you run
git commit --amendagain?
git addgit log --oneline --graphgit log -pgit showgit commit --amend