Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git branch no tracking information

Tags:

git

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.

like image 380
1392023093user Avatar asked Sep 23 '15 01:09

1392023093user


1 Answers

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
like image 94
xdazz Avatar answered Sep 21 '22 10:09

xdazz