Reputation: 422
I have committed a file with message 'initial2'. Then I commit again with 'initial3'.
I execute the command git rebase -i HEAD~2
I see the vim editor with the following content.
pick 284d2e1 'initial2'
pick e32d7f3 'initial3'
I edit 'initial2'
to 'initial2aaaaa'
and close the editor with :wq
.
However, my message is not changed. I still see initial2
.
Upvotes: 3
Views: 4122
Reputation: 21
Just to be clearer, following @Narasimha,
Upvotes: 1
Reputation: 308001
The commit message in the rebase editor is purely informational. It helps the user know which commit git is talking about (since most of us don't know the hashes of their commits by hearth). Changing it here has no effect on the plan, as you noticed. Only the command (pick
) and the hash (284d2e1
) are actually relevant to git itself.
If you want to change the commit message then change the pick
command to reword
(or just r
) to pick the commit and edit its commit message. The line should look like this:
reword 284d2e1 'initial2'
Upvotes: 4
Reputation: 809
pick 284d2e1 'initial2'
pick e32d7f3 'initial3'
when you see the above, change the first line to following (replace pick with reword)
reword 284d2e1 'initial2'
Then try exiting with :qa.
You will be given option to edit your commit message in vm.
There you can edit and exit with :qa again. Then you will find your commit message is edited.
Upvotes: 1