最近使用git時,發現執行push命令時,出現了下面的提示:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
好像是push命令有兩種方式,讓我選擇其中一種,上網查了一下,發現果然是這樣的
matching(匹配所有分支)
matching
參數是 Git 1.x 的默認參數,也就是老的執行方式。其意是如果你執行 git push 但沒有指定分支,它將 push 所有你本地的分支到遠程倉庫中對應匹配的分支。
simple(匹配單個分支)
simple
參數是 Git 2.x 默認參數,意思是執行 git push 沒有指定分支時,只有當前分支會被 push 到遠程倉庫。
所以
如果我們想使用matching
方式,可以在命令行輸入:
git config --global push.default matching
如果我們想使用simple
方式,可以在命令行輸入:
git config --global push.default simple