We'll go back into our history with
git log --oneline
and then we can pick a previous commit and change its commit message with an interactive rebase. (Note: you shouldn't try to do this on commits that have already been pushed - only commits you still have locally)
To start the interactive rebase, we'll use:
git rebase -i HEAD~3
and then change pick
to reword
. Then we can reword the commit message and the commit will be rewritten for us.