在從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