From: John Keeping <john@keeping.me.uk>
To: Jesse Hopkins <jesse.hops@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: determine name of tag used for checkout when multiple tags exist?
Date: Fri, 4 Sep 2015 12:19:15 +0100 [thread overview]
Message-ID: <20150904111915.GB27660@serenity.lan> (raw)
In-Reply-To: <CAL3By-8cgAz1Jau3NO0kkHAVwvy3hPMMUn=xwUtY78TE5WE9vw@mail.gmail.com>
[It looks like your reply didn't get through to the mailing list,
presumably because it contained a text/html part.]
On Fri, Sep 04, 2015 at 04:22:04AM -0600, Jesse Hopkins wrote:
> On Sep 4, 2015 1:54 AM, "John Keeping" <john@keeping.me.uk> wrote:
> > When I checkout a tag, "git reflog -1" gives something like:
> >
> > 989d251 HEAD@{0}: checkout: moving from master to v0.9.2
> >
> > Since whitespace isn't permitted in tag names you can do something like:
> >
> > tag=$(git reflog -1)
> > tag=${tag##* }
> > git cat-file tag "$tag" >/dev/null 2>&1 || echo "not a tag!"
>
> Thanks John that seems promising. One limitation it seems is that the
> reflog doesn't contain the tag name on a freshly cloned repo which used the
> tag as the -b option. However it seems I can recover the tag name from
> the reflog so long as I clone against something other than the tag, then
> checkout the tag.
I think it would be a reasonable enhancement to include the branch name
in the reflog message if "-b" is given to "git clone", but I'm not aware
of any (formal) policy on the format of reflog messages so relying on
any particular message may not be 100% reliable across Git upgrades.
next prev parent reply other threads:[~2015-09-04 11:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-04 2:53 determine name of tag used for checkout when multiple tags exist? Jesse Hopkins
2015-09-04 4:59 ` Jacob Keller
2015-09-04 7:54 ` John Keeping
[not found] ` <CAL3By-8ieAQPyR9k63_T5Fa9ZnAY8qSNZUpr_=fxebEcN=Zi7g@mail.gmail.com>
[not found] ` <CAL3By-8cgAz1Jau3NO0kkHAVwvy3hPMMUn=xwUtY78TE5WE9vw@mail.gmail.com>
2015-09-04 11:19 ` John Keeping [this message]
2015-09-05 14:23 ` Jesse Hopkins
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=20150904111915.GB27660@serenity.lan \
--to=john@keeping.me.uk \
--cc=git@vger.kernel.org \
--cc=jesse.hops@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).