我发现 Git 的文档对这个问题非常晦涩难懂。我想做一件简单的事情,但似乎做起来并不简单。
我有以下情况:
我有以下情况:
$ git remote -v
origin git://192.168.0.49/mnt/repos
stick /mnt/titanium/podaci/repos
我可以使用git pull命令从远程仓库获取并合并代码,这个命令非常好用:
$ git pull
Already up-to-date.
我可以像这样从棍子中拉取:
$ git pull stick master
Already up-to-date.
然而,当我从没有 master 部分的 stick 中拉取时,我收到了这条消息:
$ git pull stick
From /mnt/titanium/podaci/repos
* [new branch] su2009 -> stick/su2009
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either. Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.
If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:
branch.master.remote = <nickname>
branch.master.merge = <remote-ref>
remote.<nickname>.url = <url>
remote.<nickname>.fetch = <refspec>
See git-config(1) for details.
这里有几件事情让我感到困惑。"你的配置文件"在这里是指什么?我应该编辑哪个文件,具体应该输入什么内容?在这种情况下昵称是什么意思?
我本来期望我要完成的任务很常见,但是我没有找到一个直截了当的、带有示例的答案。
branch.<nickname>.remote
和branch.<nickname>.merge
是相辅相成的,每个分支只能有一个remote
列表。 - mipadi