[git] 현재 해더의 tag 값 가져오기


기본

git tag -l | grep $(git describe HEAD)

응용 - Shell Script

export VERSION="$(git tag -l | grep $(git describe HEAD))"

if [ -z "$VERSION" ]; then
    echo "\$VERSION is empty"
    exit 1
fi

ref : 스택오버플로우(https://stackoverflow.com/questions/2324195/how-to-get-tags-on-current-commit)