Skip to content

Instantly share code, notes, and snippets.

@mattfinlayson
Created January 25, 2012 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattfinlayson/1677813 to your computer and use it in GitHub Desktop.
Save mattfinlayson/1677813 to your computer and use it in GitHub Desktop.
Your branch is ahead of 'origin/master' by 1 commit
I noticed that some of my Git repos give me nice status messages like "Your branch is ahead of 'origin/master' by 1 commit" whenever I do a git status while others do not.
I think it's because some of them weren't originally clones and had their "remote" configuration set up manually, but not completely in the way that you get when you run git clone with a recent version of Git. Whatever the cause was, here's the fix.
Here's a section of the .git/config file for a clone which does display the additional status information:
[remote "origin"]
url = git://github.com/rentzsch/mogenerator.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
And here's the equivalent config for a repo which doesn't show the status information:
[remote "origin"]
url = git://github.com/rentzsch/mogenerator.git
fetch = +refs/heads/*:refs/remotes/origin/*
The fix? Add the required info using git config:
$ git config branch.master.remote origin
$ git config branch.master.merge refs/heads/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment