码迷,mamicode.com
首页 > 其他好文 > 详细

git pull没有指定branch报错

时间:2015-02-12 16:26:22      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:checkout   command   telling   either   without   

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

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不会出现以下问题

git pull没有指定branch报错

标签:checkout   command   telling   either   without   

原文地址:http://suiwnet.blog.51cto.com/2492370/1614068

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!