Rewording Commit Message in Middle

Interactive rebase needed to change the commit message for commits in middle like:

In this case, we right click the parent commit my awesome changes and select the interactive rebase menu.

Git then will popup the Editor with the content like below (the commits show in reverse order, the last is the most recent commit).

pick d310b7c35 WIP: Fix blah blah
pick f3ee84093 WIP: Continue Fix blah blah
pick 07ec28ec2 Fix another stupid bug

We now change the pick to r or reword (Unfortunately, we can't change the commit message here directly) and save and close the Editor.

r d310b7c35 WIP: Fix blah blah
r f3ee84093 WIP: Continue Fix blah blah
pick 07ec28ec2 Fix another stupid bug

Git will popup the Editor again asking for the new commit message for the first commit. Now put the new message and close the Editor and do the same thing for the second commit.

Commandline:

git rebase -i HEAD~3 
# or the parent commit SHA if it's hard to count
git rebase -i <TheParentCommitSHA>

Last updated