On Sunday, August 6, 2017 at 9:14:24 AM UTC-7, Michael Gersten wrote:
>
>
> On 2017-08-05, at 9:26 PM, G. Sylvie Davies <g.sylvi...@gmail.com 
> <javascript:>> wrote:
>
>
> # get most recent annotated tag (by time-of-tagging)
> $ git for-each-ref  --sort='-*committerdate'  refs/tags | head --lines=1
>
> # get most recent lightweight tag (by time-of-commit)
> $ git for-each-ref  --sort='-committerdate'  refs/tags | head --lines=1
>
>
> "for-each-ref"?
>
> Maybe a better question: How is someone supposed to learn all the things 
> that git can do? I've never seen that one mentioned.
>
>

Tee hee!   Git knowledge is essentially passed down through an oral chain 
of transmission.  For me, I learned about "for-each-ref" when I asked a 
question on stack-overflow.

https://stackoverflow.com/questions/40479712/how-can-i-tell-if-a-given-git-tag-is-annotated-or-lightweight

By the way, back to the question at hand, I've decided this is the best 
approach:

git log --all --date-order --pretty='%H | %cD | %d' | grep 'tag: '  | head 
--lines=1

%d prints the decorations, and so it's a good way to extract the tags.

Output:

3a34412caae002accd0fc7a7fc0b718c2f34159b | Thu, 20 Apr 2017 17:29:11 +0200 
|  (tag: emacs-25.2)


- Sylvie



 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to