From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
Anatol Rudolph <a.rudolph@2vizcon.com>,
git@vger.kernel.org
Subject: Re: git branch command is incompatible with bash
Date: Tue, 28 Jul 2015 12:25:17 -0400 [thread overview]
Message-ID: <20150728162516.GA28031@peff.net> (raw)
In-Reply-To: <xmqq4mkogvb7.fsf@gitster.dls.corp.google.com>
On Tue, Jul 28, 2015 at 08:23:40AM -0700, Junio C Hamano wrote:
> I can see that "symbolic-ref --short" is much newer than the other
> one, so addition of "--abbrev-ref" to "rev-parse" may have been a
> mistake made while being desperate (i.e. not having a way to do so
> with plumbing, we wanted "some" way to do so and chose poorly).
I think --abbrev-ref can handle much more than just shortening symrefs,
though:
E.g. resolving other symbolic names:
$ git rev-parse --abbrev-ref @{u}
origin/master
Or resolving any arbitrary name you happen to have:
$ git rev-parse --abbrev-ref refs/heads/master
master
Even ones that aren't fully qualified (which would be tough to do with
simple pattern substitution):
$ git rev-parse --abbrev-ref remotes/origin/master
origin/master
Or handling ambiguities during abbreviation:
$ git tag master
$ git rev-parse --abbrev-ref HEAD
heads/master
-Peff
next prev parent reply other threads:[~2015-07-28 16:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 12:12 git branch command is incompatible with bash Anatol Rudolph
2015-07-27 21:11 ` Johannes Sixt
2015-07-27 21:49 ` Junio C Hamano
2015-07-28 7:28 ` Johannes Sixt
2015-07-28 10:01 ` Jakub Narębski
2015-07-28 15:23 ` Junio C Hamano
2015-07-28 16:25 ` Jeff King [this message]
2015-07-28 17:27 ` Johannes Sixt
2015-07-29 0:23 ` Scott Schmit
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=20150728162516.GA28031@peff.net \
--to=peff@peff.net \
--cc=a.rudolph@2vizcon.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.