From: Igor Djordjevic Date: Sat, 11 Nov 2017 02:50:46 GMT Subject: Re: Unify annotated and non-annotated tags Message-ID: <59bd5e13-01a5-6c39-04bf-c60cab4004e5@gmail.com> In-Reply-To: On 11/11/2017 03:06, Junio C Hamano wrote: > Igor Djordjevic 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. ... and I did have a feeling it should be possible in a single Git command :P Thanks.