git push.default is unset

看風景就發表於2016-04-15

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple


Matching

‘matching’ 引數是 Git 1.x 的預設行為,其意是如果你執行 git push 但沒有指定分支,它將 push 所有你本地的分支到遠端倉庫中對應匹配的分支。

Simple

而 Git 2.x 預設的是 simple,意味著執行 git push 沒有指定分支時,只有當前分支會被 push 到你使用 git pull 獲取的程式碼。

修改預設設定

從上述訊息提示中的解釋,我們可以修改全域性配置,使之不會每次 push 的時候都進行提示。對於 matching 輸入如下命令即可:

git config --global push.default matching

而對於 simple ,請輸入:

git config --global push.default simple

 

出處:http://www.oschina.net/news/45585/git-2-x-change-push-default-to-simple

相關文章