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 3356300
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:29:53+00:00 2026-05-18T02:29:53+00:00

If I do git checkout -b samename origin/samename then tracking appears to work fine.

  • 0

If I do

git checkout -b samename origin/samename

then tracking appears to work fine. If I do subsequent commits, I can then do

git push

and git pushed up my commits to origin fine.

However, if I do

git checkout -b diffname origin/samename

then tracking doesn’t work, despite this section of the pro git book:

$ git checkout -b sf origin/serverfix
Branch sf set up to track remote branch refs/remotes/origin/serverfix.
Switched to a new branch "sf"
Now, your local branch sf will automatically push to and pull from origin/serverfix

Git push just gives ‘Everything up to date’
What gives?

I am running git 1.7.1 on mac os x

Here’s the whole experiment for those that want to try it at home:

szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git add file1
szbwood-mbp15:proj4_local bwood$ git commit -m"Created file 1"
[master (root-commit) 5d50289] Created file 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file1
szbwood-mbp15:proj4_local bwood$ git push origin master:samename
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/bwood/work/gitplay/proj4_remote.git
 * [new branch]      master -> samename
szbwood-mbp15:proj4_local bwood$ git checkout -b samename origin/samename
Branch samename set up to track remote branch samename from origin.
Switched to a new branch 'samename'
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git commit -a
[samename a7af908] ..
 1 files changed, 1 insertions(+), 0 deletions(-)
szbwood-mbp15:proj4_local bwood$ git push
Counting objects: 5, done.
Writing objects: 100% (3/3), 251 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/bwood/work/gitplay/proj4_remote.git
   5d50289..a7af908  samename -> samename
szbwood-mbp15:proj4_local bwood$ git checkout -b diffname origin/samename
Branch diffname set up to track remote branch samename from origin.
Switched to a new branch 'diffname'
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git commit -a
[diffname c5bbec1] ..
 1 files changed, 1 insertions(+), 0 deletions(-)
szbwood-mbp15:proj4_local bwood$ git push
Everything up-to-date

The weird thing is, the config file looks fine..

[branch "samename"]
        remote = origin
        merge = refs/heads/samename
[branch "diffname"]
        remote = origin
        merge = refs/heads/samename
  • 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-18T02:29:54+00:00Added an answer on May 18, 2026 at 2:29 am

    This isn’t about tracking. git push by default doesn’t use tracking at all. It pushes branches with matching names to the specified remote. There’s a config parameter to control this behavior:

    push.default

    Defines the action git push should take if no refspec is given on the command line, no refspec is configured in the remote, and no refspec is implied by any of the options given on the command line. Possible values are:

    • nothing – do not push anything.
    • matching – push all matching branches. All branches having the same name in both ends are considered to be matching. This is the default.
    • tracking – push the current branch to its upstream branch.
    • current – push the current branch to a branch of the same name.

    Again, the default is matching, so although you do have tracking set up in your first case, it’s just the matching names that tell it what to push. If you want, you can certainly set push.default to tracking, and get the behavior you’re expecting.

    As for your quote from Pro Git… wow, Pro Git is generally a great resource. I haven’t read it all the way through (I tend to head straight for manpages and source code), but everything I’ve read is great; I’m surprised to see even a tiny mistake!

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

Sidebar

Related Questions

Error message: fatal: git checkout: updating paths is incompatible with switching branches/forcing How to
How do I easily undo a git rebase? A lengthy manual method is: checkout
Git has a much-touted(?) octopus-merge capability that can merge many heads into one. But
running git instaweb in my repository opens a page that says 403 Forbidden -
Our git server will be local, but we want an server where our local
In Git, how could I search for a file or directory by path across
Since Git has the ability to keep track (and keep it clean) of branches
Some Git commands take commit ranges and one valid syntax is to separate two
Suppose your git history looks like this: 1 2 3 4 5 1–5 are
In a previous Git question , Daniel Benamy was talking about a workflow in

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.