You can do it as follows, as @gregg said to use the word reword
git rebase -i HEAD~n
Here n is a list of the last n commits.
For example, if you use git rebase -i HEAD~4
pick e459d80 Do xyz pick 0459045 Do something pick 90fdeab Do blah blah blah pick 90fdeab Do pqr
Now replace pick with reword for the commit you want to change.
pick e459d80 Do xyz reword 0459045 Do something reword 90fdeab Do blah blah blah pick 90fdeab Do pqr
Now close and save this, you will get the opportunity to edit the commit message for which you used reword in the following windows.
You can also specify an official document here
Punit Vara Jul 25 '17 at 12:02 on 2017-07-25 12:02
source share