Re: "Your branch is ahead of 'origin' by X commits"
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