Revision 58d6304a8688ac75ce1144d67ee25fc6669e60ed authored by Alexander Veit on 27 May 2022, 19:52:17 UTC, committed by Alexander Veit on 27 May 2022, 19:52:17 UTC
2 parent s c4468de + 1fcadc2
Raw File
branch_to_tag.sh
#!/bin/sh

BRANCHNAME=$1
TAGNAME=$2

echo "Request to convert the branch ${BRANCHNAME} to a tag with the same name accepted."
echo "Processing..."
echo " "

git show-ref --verify --quiet refs/heads/${BRANCHNAME}
# $? == 0 means local branch with <branch-name> exists. 

if [ $? == 0 ]; then
   git checkout ${BRANCHNAME}
   git tag ${BRANCHNAME}
   git checkout develop
   git branch ${BRANCHNAME} -d
   echo " "
   echo "Updated list branches, sorted chronologically: "
   echo "---------------------------------------------- "
   git log --no-walk --date-order --oneline --decorate $(git rev-list --branches --no-walk) | cut -d "(" -f 2 | cut -d ")" -f 1
else
   echo "Sorry. The branch ${BRANCHNAME} does NOT seem to exist. Exiting."
fi
back to top