git pull没有指定branch报错

当我们使用如下命令检出开发分支:

git checkout -v dev

然后再dev分支上git pull时候经常报如下错误:

HEAD is now at 990a248 Merge branch 'dev' of git.avlyun.org:userc/new-6xx into dev
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>

当你从远程仓库克隆时,实际上Git自动把本地的master分支和远程的master分支对应起来了,并且,远程仓库的默认名称是origin,所以在master分支时,使用git pull一般都不会报错,这时候需要将dev分支关联到远程分支:

git branch --set-upstream dev origin/dev

关联之后,再使用git pull不会出现以下问题

你可能感兴趣的:(command,checkout,telling)