HawkClear
HawkClear

Reputation: 19

How can I display the version number in git for the hash value of a tag?

I am working on the PowerShell right now and would like to display the version and if possible the description of a tag from which I get the hash value. By version I mean something like 55.1.

How can I do this on the PowerShell?

I thank you already for help

Upvotes: 1

Views: 235

Answers (1)

VonC
VonC

Reputation: 1327164

You could either:

In both cases, you will be able to type:

git show-ref --tags

To list tags version and their sha

Or, for a given commit SHA:

git log --oneline --decorate --tags --no-walk -1 <SHA>

Or, as suggested, with git 2.7+:

git for-each-ref --points-at <commit> --format '%(refname)'
git branch --points-at <commit>
git tag --points-at <commit>

Upvotes: 0

Related Questions