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:36:10 +0000	[thread overview]
Message-ID: <D465E524.B977%ernesto.alfonsogonzalez@ge.com> (raw)
In-Reply-To: <20161201222354.yu2q62udi56ygyoz@sigill.intra.peff.net>

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)




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

>On Thu, Dec 01, 2016 at 10:03:33PM +0000, 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


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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 22:03 EXT: Re: "Your branch is ahead of 'origin' by X commits" Alfonsogonzalez, Ernesto (GE Digital)
2016-12-01 22:20 ` Junio C Hamano
2016-12-01 22:23 ` Jeff King
2016-12-01 22:36   ` Alfonsogonzalez, Ernesto (GE Digital) [this message]
  -- 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=D465E524.B977%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