Skip to contentSkip to conversation

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

DISCUSSION Alfonsogonzalez, Ernesto (GE Digital) 1 participant 1 message Dec 2, 2016

lore
Share & tools
lore
#0 lore raw

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

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

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 <file>..." 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)
Quoted 30 lines · Matthieu Moy

"Alfonsogonzalez, Ernesto (GE Digital)" <[email protected]>

Quoted 11 lines · 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?

Signature · 5 lines
Matthieu Moy
https://urldefense.proofpoint.com/v2/url?u=http-3A__www-2Dverimag.imag.fr_
-7Emoy_&d=DQIDAw&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=izgsnUPc7
Qu6cAMH0HZnmitAbT-LmaLVojOu8tH2KqE&m=0Kz9dpPPuw6T-zLqzY80QygN-4VoMVQeauR_x
WR5fN8&s=DnD-WMGSm71Y05CEheJw-NdYA0FVP2ze6KqWxrEKswE&e=