I learned from this blog.
git commit --amend
Rebasing is the process of moving a branch to a new base commit.
git rebase -i HEAD~3
The result is as follows:
pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file
We can see the last 3 commits. Find the commit message to modify and change pick
to edit
edit f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file
Save and quit. Then run commit
command.
git commit --all --amend
or
git commit --amend
After committing the fixed version, do:
git rebase --continue