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

2016-12-02 Thread Alfonsogonzalez, Ernesto (GE Digital)
Hi Matthieu,

It was my mistake, I had a local branch called “origin” which was the
upstream for master.
I sent more details in a later email, reproduced below. Sorry for the
false alarm.

Thanks,

Ernesto


>>

Yes, it looks like I had a local branch “origin” which was behind by 108
commits. 

Setting upstream to the local branch correctly states "track local branch
origin”.

It was my mistake, there is no bug.

Thanks,


$ git rev-parse --symbolic-full-name origin
refs/heads/origin
# origin is a local branch

$ git show refs/heads/origin
commit ad8c3ee6cb7740627e4ecddb418c826bc8597d3d # old commit, 108 commits
behind master


$ git branch
...
* master
...
  origin
...

$ git show origin 
commit ad8c3ee6cb7740627e4ecddb418c826bc8597d3d
Merge: e16bda3 4b7564d

$ git branch --set-upstream-to=origin/master
Branch master set up to track remote branch master from origin


$ git branch --set-upstream-to=origin #correctly says "track local branch
origin"
Branch master set up to track local branch origin.

$ 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 ..." to include in what will be committed)

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


$ git branch -d origin
Deleted branch origin (was ad8c3ee).
$

$ git status
On branch master
Your branch is based on 'origin', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)





On 12/2/16, 5:42 AM, "Matthieu Moy"  wrote:

>"Alfonsogonzalez, Ernesto (GE Digital)" 
>writes:
>
>> Hi,
>>
>> Git status tells me "Your branch is ahead of 'origin' by 108 commits.²,
>> but my local and origin/master are pointing to the same commit.
>>
>> What am I doing wrong?
>>
>> $ git diff origin/master
>> $ git status
>> On branch master
>> Your branch is ahead of 'origin' by 108 commits.
>
>This line should say "ahead of 'origin/master'" in common setups, where
>'origin/master' is the remote-tracking branch configured as upstream for
>'master'.
>
>My guess is that you have a badly configured upstream.
>
>What does "git pull -v" say? What's the content of the [branch "master"]
>section of .git/config?
>
>-- 
>Matthieu Moy
>https://urldefense.proofpoint.com/v2/url?u=http-3A__www-2Dverimag.imag.fr_
>-7Emoy_=DQIDAw=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI=izgsnUPc7
>Qu6cAMH0HZnmitAbT-LmaLVojOu8tH2KqE=0Kz9dpPPuw6T-zLqzY80QygN-4VoMVQeauR_x
>WR5fN8=DnD-WMGSm71Y05CEheJw-NdYA0FVP2ze6KqWxrEKswE= 



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

2016-12-02 Thread Matthieu Moy
"Alfonsogonzalez, Ernesto (GE Digital)" 
writes:

> Hi,
>
> Git status tells me "Your branch is ahead of 'origin' by 108 commits.²,
> but my local and origin/master are pointing to the same commit.
>
> What am I doing wrong?
>
> $ git diff origin/master
> $ git status
> On branch master
> Your branch is ahead of 'origin' by 108 commits.

This line should say "ahead of 'origin/master'" in common setups, where
'origin/master' is the remote-tracking branch configured as upstream for
'master'.

My guess is that you have a badly configured upstream.

What does "git pull -v" say? What's the content of the [branch "master"]
section of .git/config?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/


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

2016-12-01 Thread Alfonsogonzalez, Ernesto (GE Digital)
Yes, it looks like I had a local branch “origin” which was behind by 108
commits. 

Setting upstream to the local branch correctly states "track local branch
origin”.

It was my mistake, there is no bug.

Thanks,


$ git rev-parse --symbolic-full-name origin
refs/heads/origin
# origin is a local branch

$ git show refs/heads/origin
commit ad8c3ee6cb7740627e4ecddb418c826bc8597d3d # old commit, 108 commits
behind master


$ git branch
...
* master
...
  origin
...

$ git show origin 
commit ad8c3ee6cb7740627e4ecddb418c826bc8597d3d
Merge: e16bda3 4b7564d

$ git branch --set-upstream-to=origin/master
Branch master set up to track remote branch master from origin


$ git branch --set-upstream-to=origin #correctly says "track local branch
origin"
Branch master set up to track local branch origin.

$ 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 ..." to include in what will be committed)

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


$ git branch -d origin
Deleted branch origin (was ad8c3ee).
$

$ git status
On branch master
Your branch is based on 'origin', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)




On 12/1/16, 2:23 PM, "Jeff King"  wrote:

>On Thu, Dec 01, 2016 at 10:03:33PM +, Alfonsogonzalez, Ernesto (GE
>Digital) wrote:
>
>> 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.
>
>Ah, that makes sense.
>
>> I¹m still not sure what it means for the branch upstream to be ³origin²
>> only.
>
>The name "origin" generally resolves to refs/remotes/origin/HEAD, which
>is a symbolic ref pointing to the "default branch" for that remote.
>That's generally set at clone time from what the remote has in its HEAD,
>but you can update it with "git remote set-head" if you want to.
>
>But that's just for resolving the name; I'm not sure that it would work
>to set a branch's upstream to just "origin".  Do you possibly have
>another ref named origin?
>
>-Peff



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

2016-12-01 Thread Jeff King
On Thu, Dec 01, 2016 at 10:03:33PM +, Alfonsogonzalez, Ernesto (GE Digital) 
wrote:

> 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.

Ah, that makes sense.

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

The name "origin" generally resolves to refs/remotes/origin/HEAD, which
is a symbolic ref pointing to the "default branch" for that remote.
That's generally set at clone time from what the remote has in its HEAD,
but you can update it with "git remote set-head" if you want to.

But that's just for resolving the name; I'm not sure that it would work
to set a branch's upstream to just "origin".  Do you possibly have
another ref named origin?

-Peff


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

2016-12-01 Thread Junio C Hamano
"Alfonsogonzalez, Ernesto (GE Digital)"
 writes:

> I'm still not sure what it means for the branch upstream to be 'origin'
> only.

If only you checked who the upstream of your 'master' was before
doing the set-upstream-to, it would have been trivial to answer that
question, but that is water under the bridge now.

A wild guess is that the upstream of your 'master' was 'origin/HEAD'
(whose name, when fully spelled out, is "refs/remotes/origin/HEAD"),
which pointed to something other than "refs/remotes/origin/master"?



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

2016-12-01 Thread Alfonsogonzalez, Ernesto (GE Digital)
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 ..." 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"  wrote:

>On Thu, Dec 01, 2016 at 07:49:40PM +, 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 ..." 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



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

2016-12-01 Thread Jeff King
On Thu, Dec 01, 2016 at 07:49:40PM +, 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 ..." 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


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

2016-12-01 Thread Alfonsogonzalez, Ernesto (GE Digital)
Hi,

Git status tells me "Your branch is ahead of 'origin' by 108 commits.²,
but my local and origin/master are pointing to the same commit.

What am I doing wrong?

$ 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 ..." to include in what will be committed)

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



$ 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


$ git --version 
git version 2.10.2




Thanks,

Ernesto