[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@xxxxxxxxxxxxx> 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html