Reputation: 17505
Everytime I push new change/branch to Gerrit:
git push origin HEAD:refs/for/82-blah
and pull everything back (with git pull
) I always get comment message saying:
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
I don't recall seeing the same message, when pushing to non-Gerrit Git repos. Isn't something Gerrit-specific or am I missing something?
Is there any way to avoid this message (hook?), so I wouldn't have to do:
git branch --set-upstream-to=origin/82-blah 82-blah
before each pull?
Upvotes: 1
Views: 1727
Reputation: 3497
this is not Gerrit specific. The tracking information can be found in the repo config file - .git/config
. A local branch is remote tracking if there is a merge info added to the branch specific section:
[branch "82-blah"]
remote = origin
merge = refs/heads/82-blah
So I think this info is missing in your config. How did you create the local branch that is the question. if with git checkout -b <branch>
then there will be no tracking info added to that local branch. Better to use git checkout -b <branch> origin/<branch>
or git checkout <branch>
. With these commands the tracking info will be added by default. (with --no-track
switvh it can be skipped). you can define the tracking info anytime with git config <branch>.remote origin and git config <branch>.merge refs/heads/<branch>
as well.
Upvotes: 1
Reputation: 1616
You can set the upstream in your first or any later pushes, so you do not have to repeat it afterwards:
git checkout 82-blah
git push origin -u
Upvotes: 1