Git no tracking information

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 

The problem is that I created this branch and made commit tones on this branch and switched to other branches and returned to this. Than the new user added a few commits, and after that I get this message.

My question is not how to fix it, I want to know what is the reason for this and how to prevent its recurrence.

+6
source share
1 answer

This is because you did not install upstream (which means which remote branch you want to track).

To set up a remote tracking branch:

If the local branch is created on your local computer, then when you click on the remote computer, you can use the -u / --set-upstream option when you do git push .

If a branch is pulled from a remote branch, you can use the --track option when you do a git checkout .

To fix this (install the remote tracking branch), simply run the git command:

 git branch --set-upstream-to=origin/<branch> my_branch 
+8
source

All Articles