Git development
 help / color / mirror / Atom feed
From: "Alfonsogonzalez, Ernesto (GE Digital)"  <ernesto.alfonsogonzalez@ge.com>
To: Jeff King <peff@peff.net>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: EXT: Re: "Your branch is ahead of 'origin' by X commits"
Date: Thu, 1 Dec 2016 22:03:33 +0000	[thread overview]
Message-ID: <D465DC74.B911%ernesto.alfonsogonzalez@ge.com> (raw)

Hi Jeff,

I followed all your steps, but didn¹t find anything.

$ ls -d .git
.git
$ ls .git/master
ls: .git/master: No such file or directory
$ git show HEAD
commit 92d392c37e376db69d61dafdc427b379d860fb5a
Merge: 6be322c 5544904
...
$ git show refs/heads/master
commit 92d392c37e376db69d61dafdc427b379d860fb5a
Merge: 6be322c 5544904
...
$ git rev-parse --symbolic-full-name master
refs/heads/master
$

Then I realized that the message should say,

"Your branch is ahead of Œorigin/master' by X commits"
And not

"Your branch is ahead of 'origin' by X commits²


So I used branch ‹set-upstream and see the expected behavior.

$ git branch --set-upstream-to=origin/master
Branch master set up to track remote branch master from origin.
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

 ...
nothing added to commit but untracked files present (use "git add" to
track)
$ 




I¹m still not sure what it means for the branch upstream to be ³origin²
only.

I do have 2 remotes. A 2nd remote, called ³teamname-origin², is indeed
behind my local master by 108 commits.

So it seems there is a bug. When master¹s upstream is ³origin², it was
actually pointing to ³teamname-origin/master², which is behind by 108
commits.

However, pushing, pulling, rebasing, etc, all work against the correct
remote (³origin²). 

So this could be a bug in git status?

Thanks,

Ernesto


On 12/1/16, 1:47 PM, "Jeff King" <peff@peff.net> wrote:

>On Thu, Dec 01, 2016 at 07:49:40PM +0000, Alfonsogonzalez, Ernesto (GE
>Digital) wrote:
>
>> $ 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:
>
>> $ 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


             reply	other threads:[~2016-12-01 22:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 22:03 Alfonsogonzalez, Ernesto (GE Digital) [this message]
2016-12-01 22:20 ` EXT: Re: "Your branch is ahead of 'origin' by X commits" Junio C Hamano
2016-12-01 22:23 ` Jeff King
2016-12-01 22:36   ` Alfonsogonzalez, Ernesto (GE Digital)
  -- strict thread matches above, loose matches on Subject: below --
2016-12-02 18:35 Alfonsogonzalez, Ernesto (GE Digital)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D465DC74.B911%ernesto.alfonsogonzalez@ge.com \
    --to=ernesto.alfonsogonzalez@ge.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox