Skip to content

Instantly share code, notes, and snippets.

@sethfischer
Forked from mjj2000/get-current-git-tag.sh
Created September 18, 2022 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethfischer/dc8785f3649e8d4cba74bc90e99b01e2 to your computer and use it in GitHub Desktop.
Save sethfischer/dc8785f3649e8d4cba74bc90e99b01e2 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
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment