Skip to content

Instantly share code, notes, and snippets.

@sankar4n
Forked from mjj2000/get-current-git-tag.sh
Created December 8, 2024 03:34
Show Gist options
  • Save sankar4n/e948ba30c483e19340d154a41a4979a8 to your computer and use it in GitHub Desktop.
Save sankar4n/e948ba30c483e19340d154a41a4979a8 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