git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: pedro rijo <pedrorijo91@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Find main branch
Date: Thu, 14 Jan 2016 16:04:52 -0500	[thread overview]
Message-ID: <20160114210452.GA10825@sigill.intra.peff.net> (raw)
In-Reply-To: <CAPMsMoBNzmK618NPP-VXP_70hTxTsa13O9f_usiCPJ-SUOUz_g@mail.gmail.com>

On Thu, Jan 14, 2016 at 06:40:15PM +0000, pedro rijo wrote:

> Stefan Beller solution is based on the server, which may not be very
> easy to do when dealing with Github/Bitbucket/Gitlab and other God
> knows which provider.
> 
> Konstantin ls-remote solution is the one I'm already using, but if I
> have several branches on that commit, I will not be able to decide.

Right. Git used to guess, but that was not great exactly because of the
ambiguity you have seen. Servers started publishing the value of the
HEAD symref in git v1.8.4.3. I'd expect that to be available on any
modern server.

There's unfortunately not a plumbing command to directly access the
value, but "git remote set-head $remote -a" will query the remote and
update refs/remotes/$remote/HEAD appropriately. As a bonus, if it's an
older server that doesn't provide the HEAD value, it will fallback to
the "old" heuristics (see guess_remote_head for details).

-Peff

      parent reply	other threads:[~2016-01-14 21:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14 18:17 Find main branch pedro rijo
2016-01-14 18:26 ` Stefan Beller
2016-01-14 18:31 ` Konstantin Khomoutov
2016-01-14 18:40   ` pedro rijo
2016-01-14 18:53     ` Konstantin Khomoutov
2016-01-14 19:12     ` Bryan Turner
2016-01-14 21:13       ` Jeff King
2016-01-15 10:49         ` pedro rijo
2016-01-15 17:30         ` Junio C Hamano
2016-01-15 18:02           ` Jeff King
2016-01-14 21:04     ` Jeff King [this message]

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=20160114210452.GA10825@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=pedrorijo91@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).