Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting commits' tag in git

Tags:

git

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

like image 846
artemave Avatar asked Nov 05 '09 13:11

artemave


2 Answers

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

git tag --contains <commit>
like image 145
Bombe Avatar answered Nov 11 '22 06:11

Bombe


To show the tag of a commit:

$ git describe --tags <commit>

To show the preceding commit:

$ git rev-list -1 <commit>^

To show the following commit:

$ git rev-list -1 <commit>..HEAD
like image 38
Ben James Avatar answered Nov 11 '22 06:11

Ben James