I want to extract the number of latest version of a Git repository. This what I've done so far:
#--- Checking out latest tag
printf "%bChecking out tag...%b\n" "${YELLOW}" "${GRAY}"
LATEST_TAG=$(git describe --tags)
printf "\nChecking out tag %b${LATEST_TAG}%b\n" "${YELLOW}" "${GRAY}"
git checkout -b V${LATEST_TAG%-*} ${LATEST_TAG}
My problem is that if git describe --tags
returns something like this 1.0.0-39-gf8f8306
I end up creating a branch V1.0.0-39
.
What I want is to create a branch named V1.0.0
.