Reputation: 1096
After git pull I get this output.
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=origin/<branch> my_branch
Problem is that I have created that branch and have done tones of commits on this branch and switching to other branches and getting back to this one. Than a new user added few commits and after that I am getting this message.
My question is not how to fix this I want to know what cause this and how to prevent it from happening again.
Upvotes: 8
Views: 17268
Reputation: 160843
This is because you didn't set the upstream
(which means which remote branch you want to track).
To set the tracking remote branch:
If the local branch is created in your local machine, then when you push to the remote, you could use -u
/--set-upstream
option when you do git push
.
If the branch is checked out from a remote branch, then you could use --track
option when you do git checkout
.
To fix this(set a remote tracking branch), just do what git tell you:
git branch --set-upstream-to=origin/<branch> my_branch
Upvotes: 11