How do I edit or reword a merge commit\'s message?
git commit --amend
works if it\'s the last commit made (HEAD
), but what if it comes befo
Use the --rebase-merges
(or the shortened -r
) flag:
git rebase -i -r HEAD~5
Then change the 'pick' text to 'edit' or 'reword' next to the commit to change:
pick <commit-hash-to-leave> <message>
edit <commit-hash-to-change> <message>
The --rebase-merges
flag replaces the deprecated --preserve-merges
(or the shortened -p
)
Documentation: https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt--r