Reputation: 24218
When I do a git log filename
or some listing of the commits that a file has been through, I'd like to see all the tags that were applied to the repository where the file was exactly the version specified in the git log filename
. Is this possible?
Upvotes: 0
Views: 137
Reputation: 10273
First, figure out the commit hash of the commit you are interested in -- in this example it is 6502bcc16b3790cc22cb771d1da3e8f35b4009c0:
$ git log «filename»
commit 6502bcc16b3790cc22cb771d1da3e8f35b4009c0
Author: Mike Morearty <[email protected]>
Date: Wed Jun 13 16:04:56 2012
added «filename»
Then, use git tag --contains
to ask for all tags that contain that commit:
$ git tag --contains 6502bcc16b3790cc22cb771d1da3e8f35b4009c0
tag1
tag2
If you want to do all of that in one line, here is one way (perhaps there are more efficient ways):
$ git tag --contains $(git log -1 --pretty=%H «filename»)
Upvotes: 1