git 執行git push 和git pull的操做時候,常常看到下面的提示:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.dev.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "dev"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
在高版本的 git下面,也許會看見這樣的提示:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with
git branch --set-upstream master origin/<branch>
看到第二個提示,咱們如今知道了一種解決方案。也就是指定當前工做目錄工做分支,跟遠程的倉庫,分支之間的連接關係。
好比咱們設置master對應遠程倉庫的master分支
git branch --set-upstream master origin/master
這樣在咱們每次想push或者pull的時候,只須要 輸入git push 或者git pull便可。
在此以前,咱們必需要指定想要push或者pull的遠程分支。
git push origin master
git pull origin master.git