Getting commits tag in git

Gitk has a good habit of showing me Tags :, Follows: and Precedes: for commit. How to get the same information from the command line?

+6
git
source share
2 answers

To show the commit tag:

$ git describe --tags <commit> 

To show the previous commit:

 $ git rev-list -1 <commit>^ 

To display the following commit:

 $ git rev-list -1 <commit>..HEAD 
+4
source share

To show tags that contain a commit (i.e. tags precede a commit):

 git tag --contains <commit> 
+8
source share

All Articles