Last active
August 29, 2015 14:23
-
-
Save giavac/af7f7a76dddf71ce2493 to your computer and use it in GitHub Desktop.
Get tag or latest commit hash
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
LASTCOMMIT=$(git rev-parse --short HEAD) | |
CONFVERSION=$LASTCOMMIT | |
TAG=$(git show-ref --tags -d | grep ^${LASTCOMMIT} | sed -e 's,.* refs/tags/,,' -e 's/\^{}//') | |
if [ "$TAG" != "" ] | |
then | |
CONFVERSION=$TAG | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment