Git: How to edit/reword a merge commit's message?

后端 未结 7 1908
有刺的猬
有刺的猬 2020-12-07 08:40

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

7条回答
  •  执念已碎
    2020-12-07 09:35

    If you add the --preserve-merges option (or its synonym, -p) to the git rebase -i command then git will try to preserve the merges when rebasing, rather than linearizing the history, and you should be able to amend the merge commits as well:

    git rebase -i -p HEAD~5
    

提交回复
热议问题