tags:

views:

53

answers:

2

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

+3  A: 

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
Ben James
Follows: and Precedes: actually relate to tags, not commits. So your rev-list examples in fact answer different question. But that is ok, since 'git describe' is just what I was looking for. Thanks!
artemave
OK -- sorry, I do not use gitk! But I'm glad I still gave something useful
Ben James
The solution is `git describe` + `git describe --contains` (as per two answers)
Jakub Narębski
Also there is `git describe --abbrev=0 <commit>` trick... and `git log --decorate`.
Jakub Narębski
+2  A: 

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

git tag --contains <commit>
Bombe