Skip to content

Instantly share code, notes, and snippets.

@deichcode
Created July 26, 2018 06:23
Show Gist options
  • Save deichcode/6c4e35de2f1de6b3074f9055672709f8 to your computer and use it in GitHub Desktop.
Save deichcode/6c4e35de2f1de6b3074f9055672709f8 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]
then
echo "enter prefix: "
read prefix
else
prefix="$1"
fi
if [ -z "$2" ]
then
echo "enter tag: "
read tag
else
tag="$2"
fi
old=$tag
new=$prefix$tag
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
#Based on: https://gist.github.com/jloveland/22b641ace8e64df189b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment