1. 程式人生 > >git 同步程式碼

git 同步程式碼

自己同步本地資料的時候。在執行 git push 時看到如下訊息:

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’ 引數是 Git 1.x 的預設行為,其意是如果你執行 git push 但沒有指定分支,它將 push 所有你本地的分支到遠端倉庫中對應匹配的分支。 而 Git 2.x 預設的是 simple,意味著執行 git push 沒有指定分支時,只有當前分支會被 push 到你使用 git pull 獲取的程式碼。

根據提示,修改git push的行為:

git config --global push.default
matching

再次執行 git push 得到解決。