On Sat, Nov 11, 2017 at 5:06 AM, Junio C Hamano <gits...@pobox.com> wrote: > Igor Djordjevic <igor.d.djordje...@gmail.com> writes: > >> If you would like to mimic output of "git show-ref", repeating >> commits for each tag pointing to it and showing full tag name as >> well, you could do something like this, for example: >> >> for tag in $(git for-each-ref --format="%(refname)" refs/tags) >> do >> printf '%s %s\n' "$(git rev-parse $tag^0)" "$tag" >> done >> >> >> Hope that helps a bit. > > If you use for-each-ref's --format option, you could do something > like (pardon a long line): > > git for-each-ref > --format='%(if)%(*objectname)%(then)%(*objectname)%(else)%(objectname)%(end) > %(refname)' refs/tags > > without any loop, I would think.
Thanks. That helps. So my proposal is to get rid of non-annotated tags, so to get all tags with commits that they point to, one would use: git for-each-ref --format='%(*objectname) %(refname)' refs/tags For so-called non-annotated tags just leave the message empty. I don't see why anyone would need non-annotated tags though. -- anatoly t.