簡體   English   中英

如何使git merge的默認值為--no-ff --no-commit?

[英]How do I make git merge's default be --no-ff --no-commit?

公司策略是使用--no-ff進行合並提交。 我個人喜歡調整合並日志消息,所以我使用--no-commit 另外,我想在提交之前進行實際的編譯和測試。

如何為所有分支制作--no-ff--no-commit默認值?

(而且我在問這個以后的幾年里學到了,我幾乎總是對提交感到滿意,因此默認情況下允許它提交更簡單,只要我修改或以其他方式解決問題,然后再進行推送都好...)

把它放在$ HOME / .gitconfig中:

[merge]
    ff = no
    commit = no

您可以使用git-config執行此操作:

  git config --global merge.commit no
  git config --global merge.ff no

要使--no-ff --no-commit默認合並行為,請使用以下選項將選項設置為no

git config --global merge.ff no
git config --global merge.commit no

但是,這個問題是git pull = git fetch + git merge 因此,無論何時從遠程服務器拔出,都需要創建一個丑陋的合並提交,這樣才能保證簡單的快進。 要解決此問題,請將pull.ff設置為yes

git config --global pull.ff yes

從git版本1.7.6開始,你應該使用

git config [--global] merge.ff no

在每次合並中使用--no-ff “強制”。

默認行為是

git config [--global] merge.ff yes

git config [--global] merge.ff only

它將拒絕非快進合並

根據手冊 ,你應該使用

$ git config [--global] merge.ff false

默認情況下,使用git-config實用程序為所有分支設置no-fast-forward選項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM