在从origin/base
分支合并分支到我的feature
分支之后,我必须解决文件Parameter.java
上的一个冲突。我启动了我的Git合并工具,并解决了它。一旦解决了问题,我执行了git commit
,并打开Vim,并显示默认合并提交消息。Git默认合并提交消息不包括冲突
事情是,这个默认提交消息包含冲突列表,但是从#
开始,因此它们将在提交消息中被忽略。
Merge remote-tracking branch 'origin/base' into feature
# Conflicts:
# Parameter.java
#
# It looks like you may be committing a merge.
# If this is not correct, please remove the file
# .git/MERGE_HEAD
# and try again.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch feature
# All conflicts fixed but you are still merging.
#
# Changes to be committed:
# modified: Parameters.java
# modified: SpecialParameters.java
# modified: Traveller.java
是否有一些要添加的配置来将这些冲突行自动放入提交消息中?因此,删除Conflicts
部件中冲突文件的#
?
'#该钩子包括三个例子。第一个注释是合并提交的“冲突:”部分.'写在文件的开头,所以它实际上是相反的。无论如何,我试着重新命名它,因为你建议,我重新启动Git bash,但它仍然无法正常工作,冲突部分仍然被注释掉。 – jeerbl
你说得对。我编辑了我的答案。 –
对于perl,替换'sed -i.bak'/ ^#冲突:/,/ ^#$/s /..//'“$ 1”' – jthill