Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7694785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:23:52+00:00 2026-05-31T21:23:52+00:00

I did this: git branch –track stats_page to create a separate branch to try

  • 0

I did this:

git branch --track stats_page

to create a separate branch to try something out. But now everytime I push or pull I see:

$ git pull
From .
 * branch            master     -> FETCH_HEAD

and

$ git push
Total 0 (delta 0), reused 0 (delta 0)
To .
   ff0caf5..e360168  stats_page -> master

I’m far from a git master so I might be miss understanding what’s happening – but is my stats_page branch tracking to master?

I may have created the branch wrong – if so – can I fix it so that from now on it pushes and pulls to the remote stats_page branch? How?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:23:53+00:00Added an answer on May 31, 2026 at 9:23 pm

    Quick answer: The easiest way to fix this is in Make an existing Git branch track a remote branch?

    What’s really going on here

    I’ve always found descriptions of git’s “tracking branches” confusing myself. They sound, to me at least, like they do a lot more than they really do.

    The trick, I think, is to realize that git doesn’t ever actually “track” a remote repository at all. (It does fetch from a remote repo.) Instead, a “tracking branch” tracks a branch in your own repo. To “track a remote branch”, you create a branch whose name says that it was originally copied from some other repo. (Under the covers, this means any branch stored under refs/remotes/, more or less.) The most common “other repo” is the one named origin, which is the one that an initial git clone sets up for you. As it says in the git-clone manual page:

    This default configuration is achieved by creating references to the remote branch heads under refs/remotes/origin and by initializing remote.origin.url and remote.origin.fetch configuration variables.

    When you use git branch --track to create a branch, it makes the new branch “track” the “start point” that you give it. (And, “track” mainly means “associate for various push/pull/fetch actions, and tell me more when I run git status.) So, assuming the repo you cloned-from already has a stats_page branch, you probably meant to do this:

    git branch --track stats_page origin/stats_page
    

    which tells git “make new branch named stats_page that tracks what I have in refs/remotes/origin/stats_page” (you normally leave off the refs/heads and refs/remotes parts, and git figures them out). You don’t even need the --track here, as the origin/ part on the right turns that on for you.

    Once you do all that, in git’s terminology, you have a “local” branch (refs/heads/stats_page) that tracks a “remote” branch (refs/remotes/origin/stats_page). To actually update the “remote” branch you use git fetch, or more explicitly, git fetch origin, which goes out to the URL associated with origin and collects any new stuff and then adds it to your repo. Hence, despite calling this “remote”, it’s still remarkably local: it’s right there on your own local disk.

    (I have taken to calling git “the Borg of SCMs”: “We are the git-Borg. We will add your commit distinctiveness to our own.” Most of what you do just adds new stuff to your own repo-Borg-collective.)

    Once you’ve used git fetch to update your local copy of the “remote” branch (origin/stats_page), you can do a git merge to get it merged in (to stats_page, the name without the origin/ part). And, a git pull just runs those two in one easy step—which hides the fact that it’s the fetch that actually gets new stuff from the “remote”

    Now, the problem you have is that when you ran:

    git branch --track stats_page
    

    you were on your master branch, so you created a new “local” branch named stats_page that tracks your master, instead of tracking origin/stats_page. Hence, git pull and git push just pull and push on your local branch named master. (Note: If you actually run git fetch, that still fetches into remotes/origin/*, so it still updates origin/stats_page, even though the one “local” branch is mistakenly tracking another “local” branch.)

    One last note: usually when you make a “local” branch that tracks a remote branch of the same name, you also want to do a git checkout immediately. You can just git checkout -b stats_page origin/stats_page to get all three steps done at once. (If your version of git is old, it may not automatically track when you name origin/stats_page on the right; but if so you probably should just update your version of git.)


    Footnote: Some people recommend against using git pull at all, and I sort of agree with them. git pull really mixes two very different operations. In particular git pull remote_A remote_B seems to surprise people when it does an octopus merge. Using git fetch never seems to surprise people; and once they get used to, and familiar with, an explicit git merge, the logic behind fast-forward merges makes a lot more sense. Still, git pull with no arguments is so convenient….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did this (on my production server): $ git branch * master $ git
This seems very foolish mistake, I just did a git stash pop on a
I want v0.1.27 of nodejs code base. This is what I did. git clone
I did this in Perl, but how do you the same in python? Example:
I want to create a git branch that will work independent of the master
I created a tag on the master branch called v0.1 like this: git tag
Is it possible to commit a file in a git branch without checking out
I did: git co upstream/master # To no branch. <then did a trivial edit
this is what my git status ' result looks like: # On branch master
I'm going through a tutorial and it said this command, git branch -a would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.