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.

  • Want git post receive hook to make new commit and push
  • Automatic version number both in setup.py (setuptools) AND source code?
  • How can I move files & folders using git in Xcode 4?
  • How to commit the files which were pushed before and abandoned in gerrit
  • Git email hook to include commit message and changed files
  • Creating Remote GIT server on OSX Client ( Snow Leopard ) to sync with XCode 4 local GIT Repo
  • My question is not how to fix this I want to know what cause this and how to prevent it from happening again.

  • Git/Eclipse Workflow
  • Remote git branches not shown with `git branch -r`?
  • Why is git showing text file as binary file?
  • Create an empty branch?
  • Getting file to add that was previously on ignore-paths
  • .gitignore exclude folder with files but include subdirectory
  • 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.