bash - Git displaying a sorted list of lightweight tags using a sort -
bash - Git displaying a sorted list of lightweight tags using a sort -
i have load of lightweight tags have been created in repo need sort , homecoming top 5 tags. understanding lightweight tags can't sorted date created pointer commit.
i want able (for utilize in bash script) lastly 5 (this in alphanumeric order)
so illustration if ran these commands (not ever add together tags this, highlight want):
git tag 1.0.0 git tag 1.4.0 git tag 1.2.0 git tag 1.6.0 git tag 1.7.0 git tag 1.8.0
i want list like:
1.8.0 1.7.0 1.6.0 1.4.0 1.2.0i know can
git tag | head -n5
but these not sorted correctly, first 5 tags.
i know if these annotated tags utilize git describe or
git for-each-ref --sort=-taggerdate \ --format '%(refname:short) %(taggerdate:raw)' refs/tags
but doesn't work lightweight tags afore mentioned reason.
so there way list lastly 5 (doesn't matter if sorted numerically or date same) lightweight tags?
i know http://stackoverflow.com/a/21032471/1185180 convert them, rather not....
> git tag 1.0.0 1.2.0 1.4.0 1.6.0 1.7.0 1.8.0 > git tag | sort -r | head -5 1.8.0 1.7.0 1.6.0 1.4.0 1.2.0
git bash sorting
Comments
Post a Comment