Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 972 Bytes

modify-previous-commit-messages.md

File metadata and controls

51 lines (35 loc) · 972 Bytes

Modify previous commit messages

I learned from this blog.

Modify the last commit message

git commit --amend

Modify previous commit messages

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