-
-
Save deichcode/00ffac71b56954173e6a61a499c5c3ba to your computer and use it in GitHub Desktop.
rename a git tag
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
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "enter old tag: " | |
read old | |
else | |
old="$1" | |
fi | |
if [ -z "$2" ] | |
then | |
echo "enter new tag: " | |
read new | |
else | |
new="$2" | |
fi | |
echo "old tag: " $old | |
echo "new tag: " $new | |
read -r -p "Are you sure? [y/N] " response | |
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]] | |
then | |
echo "Renaming tag" | |
git tag $new $old | |
git tag -d $old | |
git push origin :refs/tags/$old | |
git push --tags | |
else | |
echo "Exiting..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment