这可能是一个已经被问到的问题,但我只是不知道该如何称呼这个问题--所以请指导我或回答(是的,我见过这问题,但无法从答案中得到太多)。
我正在尝试git pull,但收到以下消息:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.2012_05_09_my_branch.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 "2012_05_09_my_branch"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.可能我的工作目录看起来有点“挂”而不附加到任何树枝上,对吗?如果是这样的话,请建议如何将它连接回适当的分支(例如,2012_05_09_my_branch)。也许我甚至错了(作为一个完全的新手),在这种情况下,请解释发生了什么,我能做些什么。
精炼的问题:在没有得到上面的消息的情况下,要成功地运行git push和git pull,我需要做什么?
更新:运行git branch时得到:
* 2012_05_09_my_branch
master哪种可能意味着我在本地的2012_05_09_my_branch分支上,它没有连接到任何远程分支?
Update N2: 一直? -作为一种补充材料非常值得一读(直到现在才找到)。
发布于 2012-06-03 19:37:06
这并不是说您的工作分支没有附加到分支上,而是没有设置本地分支在远程上的对等分支。您可以将它们“连接”在一起:
git branch --set-upstream 2012_05_09_my_branch remotes/<your remote>/2012_05_09_my_branch其中<您的远程>是. .git/config中定义的服务器服务器,通常(当使用一台服务器时)是origin
编辑:更安全的方法是使用remotes/<remote>/<branch>而不是<remote>/<branch>
发布于 2012-06-03 15:20:57
git status将帮助你找出你是哪个分支(如果有的话)。命令
git branch将给出一个关于您拥有的本地分支的列表(git分支-a也列出了远程分支)。当然你也可以用
git checkout <branchname>若要将工作副本转到选定的分支,请执行以下操作。
发布于 2012-06-03 19:27:34
创建本地分支并将其放到远程存储库时,需要运行以下命令:
$ git push origin 2012_05_09_my_branchhttps://stackoverflow.com/questions/10871429
复制相似问题