tags:

views:

47

answers:

2

Hi,

I have a workspace which may has multiple TAGs on a signle commit ID For example

commit #3 <--- TAG1 / TAG2/ TAG3

|

commit #2 <--- TAG4/ TAG5

|

commit #1 <--- TAG6/ TAG7

When I checked on commit-1 , I want to know the info of there are two TAGs (TAG 6/ TAG7) on current commit , but I can not find correct way to do that . I have tried:

A)git checkout commit #1

git tag --contains It will display TAG from TAG1~TAG7

B)git checkout commit #1

git describe --tags HEAD

It will display TAG6 only .

Can anybody let me know if I can get something like "TAG6/TAG7" from case above ?

Thanks, Shawn

+1  A: 

This is not ideal, but perhaps helpful:

$ git log -n 1 --decorate --pretty=oneline

You could play around with the format to get exactly what you want.

William Pursell
Thanks for your info , my repo has more than 300 different gits. Press "Q" for 300 time really hard for me .
Shawn
@Shawn There is no need to press Q...
calmh
Whenever I using git log to display anything , I need press q button to exit the log display mode . Not sure if you facing the same
Shawn
+3  A: 

Some improvements on William's answer:

git config --global alias.tags 'log -n1 --pretty=format:%h%d'

The output looks like this:

~$ git tags
7e5eb8f (HEAD, origin/next, origin/master, origin/HEAD, master)
~$ git tags HEAD~6
e923eae (tag: v1.7.0)
jleedev
this is a cool tip
Casey