Git branch 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

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.

  • Why doesn't “git status” display unpushed commits in a branch?
  • How to create concourse loop for repetitive resources and jobs?
  • Make Git not track all branches
  • Setting up different git roots for different modules in same project - Intellij IDEA
  • What is difference between “git checkout -f” and “git reset --hard HEAD”?
  • How to change folder with git bash?
  • My question is not how to fix this I want to know what cause this and how to prevent it from happening again.

  • Heroku push master ssh problem
  • git-svn: is there a way to get it to play nice with submodules, or ignore them?
  • Insight on handling static library revisions (i.e. binaries) with git
  • What are the “loose objects” that the Git GUI refers to?
  • git hook post-merge - error: cannot run
  • How to use version control on a remote development server?
  • One Solution collect form web for “Git branch no tracking information”

    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
    Git Baby is a git and github fan, let's start git clone.