Last active
November 13, 2024 08:25
-
-
Save mjj2000/3ee188cc155c26a118b06116ad0ebd1d to your computer and use it in GitHub Desktop.
[GIT] Get tag of current branch(that is HEAD) or fallback to short commit hash(7 digits) by single shell command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD |
Thanks, works perfectly.
Nice, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git describe --tags --always