Git 使用Gerrit时自动设置跟踪

Git 使用Gerrit时自动设置跟踪,git,version-control,gerrit,Git,Version Control,Gerrit,每次我向Gerrit推送新更改/分支时: git push origin HEAD:refs/for/82-blah 然后把所有东西都拉回来(使用git pull),我总是收到评论信息说: 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 <

每次我向Gerrit推送新更改/分支时:

git push origin HEAD:refs/for/82-blah
然后把所有东西都拉回来(使用git pull),我总是收到评论信息说:

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-to=<remote>/<branch> 82-blah

每次推拉之前?

您可以在第一次或以后的任何推拉中设置上游,这样以后就不必重复:

git checkout 82-blah
git push origin -u

这不是Gerrit特有的。跟踪信息可以在repo config文件-
.git/config
中找到。如果有合并信息添加到分支特定部分,则本地分支为远程跟踪:

[branch "82-blah"]
    remote = origin
    merge = refs/heads/82-blah

所以我认为这个信息在你的配置中丢失了。您是如何创建本地分支的?这是一个问题。如果使用
git checkout-b
,则不会向该本地分支添加任何跟踪信息。最好使用
git checkout-b origin/
git checkout
。默认情况下,使用这些命令将添加跟踪信息。(使用
——无音轨
switvh时,可跳过该音轨)。您可以随时使用
git config.remote origin和git config.merge refs/heads/
定义跟踪信息。

谢谢您的回答。你写道,这不是Gerrit的特例。有趣。我有另一个远程添加到我的本地repo,叫做
charon
,只是一个简单的Git,非Gerrit远程。我像往常一样创建了一个新分支(没有您提供的额外开关),然后我做了
git push charon--all
,然后
git pull charon 82 blah
,我得到了
已经是最新的
,没有任何关于设置上游等的内容。您在charon remote下有什么配置参数?也许上游
charon
(Git)和
origin
(Gerrit)遥控器有一些通用/通配符规则,只是URL不同,第二个遥控器为Gerrit添加了额外的
push=HEAD:refs/for/master
fetch=+refs/notes/*:refs/notes/*
。我想没什么不寻常的。但是我是Git/Gerrit的新手,所以我可能遗漏了一些明显的东西。可能推送规则正在执行意外的行为,请尝试不使用该规则,因为它不是必需的-它告诉我们,
Git推送原点
将被解析为
Git推送原点头:refs/for/master
请看这个-这根本不是Gerrit特有的。仅当您要推送到审阅分支时
[branch "82-blah"]
    remote = origin
    merge = refs/heads/82-blah