Git:如何编辑/重新编写合并提交的消息? [英] Git: How to edit/reword a merge commit's message?
本文介绍了Git:如何编辑/重新编写合并提交的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何编辑或重写合并提交的消息?
git commit --amend
最后一次提交( HEAD
),但如果它出现在 HEAD
?
之前
git rebase -i HEAD〜5
不会列出合并提交。
解决方案
如果添加 - preserve-merges
选项(或其同义词, -p
)添加到 git rebase -i
命令中,那么git将在重新绑定时尝试保留合并,而不是线性化历史记录,并且您应该能够修改合并提交以及:
git rebase -i -p HEAD〜5
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 before HEAD
?
git rebase -i HEAD~5
doesn't list the merge commits.
解决方案
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
这篇关于Git:如何编辑/重新编写合并提交的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文