Let's suppose that we want to keep two different tag versioning on the same repo:
v[0-9]*
for master branch versionsd[0-9]*
for development branch versions
Basic commands: https://git-scm.com/book/en/v2/Git-Basics-Tagging
Please note I am using
git version 2.14.1
. The behavior may differ according to your version
# Retrieve all tags
git tag
# Describe the latest applicable tag
git describe --tags
# If no tag available you will see something like
# fatal: No names found, cannot describe anything.
# Before creating new tags, make sure you are up to date with origin
git fetch --tags origin
# Create one tag
git tag -a d1 -s -m "first development branch tag"
git push origin d1
# I can look for specific d tags versions
git describe --match "d[0-9]*" --abbrev=0 HEAD --tags
git tag -l -n "d[0-9]*"
# d1 first development branch tag
# Increase tag version
D_TAG=$(git describe --match "d[0-9]*" --abbrev=0 HEAD --tags)
VNUM=${D_TAG//d/}
echo "d$((VNUM + 1))"
# d2
# Remove tag locally and remotely
git tag -d d1
git push --delete origin d1