1. 程式人生 > >push.default - matching / simple

push.default - matching / simple

ren .com nging 遠程倉庫 nbsp 技術分享 glob oba fig

在git commit 之後執行 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 得到解決。

push.default - matching / simple