git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "Your branch is ahead of 'origin' by X commits"

From
Jeff King <peff@peff.net>
Date
Dec 1, 2016, 21:47 UTC
Message-ID
<20161201214750.awin75rfums6mjrv@sigill.intra.peff.net>
In-Reply-To
<D465BDE6.B7DE%ernesto.alfonsogonzalez@ge.com>
On Thu, Dec 01, 2016 at 07:49:40PM +0000, Alfonsogonzalez, Ernesto (GE Digital) wrote:
Show 7 quoted lines
> $ git diff origin/master
> $ git status
> On branch master
> Your branch is ahead of 'origin' by 108 commits.
>   (use "git push" to publish your local commits)
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)

The "master" we are talking about here must always be "refs/heads/master", since it will have come from resolving the HEAD symbolic ref.

But here:
Show 5 quoted lines
> $ git show origin/master --oneline
> 92d392c Merge pull request #21 from org/branch
> 
> $ git show master --oneline
> 92d392c Merge pull request #21 from org/branch

The "master" in the second case could possibly find "master" as another name. Is it possible you have a .git/master file (this may have been created by accidentally running "git update-ref master" instead of "git update-ref refs/heads/master")?

Or other things you could check:
  # see what's on HEAD, which we know points to refs/heads/master
  git show HEAD
  # or just check refs/heads/master itself
  git show refs/heads/master
  # or just ask what "master" resolves to
  git rev-parse --symbolic-full-name master

That last one actually seems to complain that "refname 'master' is ambiguous' if you do have .git/master. I think that's a minor bug, as it should presumably follow the normal disambiguation rules used for lookup (in which .git/master always takes precedence over refs/heads/master).

-Peff
Previous: Alfonsogonzalez, Ernesto (GE Digital)Next: Matthieu Moy
Message 2 of 3 in “"Your branch is ahead of 'origin' by X commits"”
  1. Alfonsogonzalez, Ernesto (GE Digital)Dec 1, 2016
  2. Jeff KingDec 1, 2016
  3. Matthieu MoyDec 2, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.