'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
Solution 1:[1]
You could either:
- define an alias for git
- or install Posh-Git, which will with tab completion support for common git commands.
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>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
