git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git tag listing order

From
Jeff King <peff@peff.net>
Date
Nov 24, 2009, 19:00 UTC
Message-ID
<20091124185947.GA24409@coredump.intra.peff.net>
In-Reply-To
<20091124105609.0980e796@montecarlo.grandprix.int>
On Tue, Nov 24, 2009 at 10:56:09AM -0500, Peter van der Does wrote:
> I'm using git 1.6.5.3 on Ubuntu and was wondering if there is a way to
> list tags in order of when they were added to the tree, instead of
> alphabetical?
You can use for-each-ref with its sort option:
  git for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags

Though note that unannotated tags will have no taggerdate, and will all sort to the front of the list. To exclude them, I think you'd have to use a special format to grep and sort yourself. Something like:

  git for-each-ref \
    --format='%(taggerdate:iso8601) %(refname:short)' refs/tags |
    grep -v '^ ' |
    sort |
    cut -d' ' -f4-
-Peff
Previous: Peter van der DoesNext: Peter van der Does
Message 2 of 3 in “git tag listing order”
  1. Peter van der DoesNov 24, 2009
  2. Jeff KingNov 24, 2009
  3. Peter van der DoesNov 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.