• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Twitter GitHub
You are here: Home / Dev Tips / There is no tracking information for the current branch.

There is no tracking information for the current branch.

Last updated on December 1, 2020 by Sal Ferrarello

When working with Git and you run git pull sometimes this error message occurs.

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=<remote>/<branch> mybranch

Note: In the last line mybranch will likely be a different value, this is the name of the current branch you are on.

The Quick Fix

Over 99% of the time running the following corrects this problem for me.

git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD)

I even have a git alias setup to run this line for me. After this, git pull should work successfully.

What is the Problem

Why does the “There is no tracking information for the current branch.” error occur in the first place?

When you run git pull, Git tries to pull any changes from the remote copy of the branch (on a server like GitHub, GitLab, or Bitbucket) into your local branch. The “There is no tracking information for the current branch.” occurs when Git doesn’t know which branch on the server if should pull from.

Almost always you want to pull from the branch on the server origin with the same name as your local branch (mybranch). The Quick Fix above sets Git to do exactly this.

When you run the quick fix, it adds the following to your project .git/config file

[branch "mybranch"]
    remote = origin
    merge = refs/heads/mybranch

Slightly Longer Fix You Can Memorize

While I’m sure you enjoy visiting this webpage, if you want to be able to solve this issue without referring to instructions this set of steps does the same thing as the one-line quick fix but is easier to remember.

  1. Copy the last line of the error message.
    git branch --set-upstream-to=<remote>/<branch> mybranch
    Instead of mybranch the last section will be the name of your current Git branch
  2. Using the arrows and Backspace key, replace <remote>/<branch> from the middle of the command with origin/, the result should look something like
    git branch --set-upstream-to=origin/mybranch
  3. Hit Enter
Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

TwitterFacebookLinkedInEmailReddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Solution Tagged With: Git

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2021 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in