Skip to content

Instantly share code, notes, and snippets.

@jloveland
Created October 5, 2014 02:48
Show Gist options
  • Save jloveland/22b641ace8e64df189b8 to your computer and use it in GitHub Desktop.
Save jloveland/22b641ace8e64df189b8 to your computer and use it in GitHub Desktop.
rename a git tag
#!/bin/bash
echo "enter new tag: "
read new
echo "enter old tag: "
read old
echo "new tag: " $new
echo "old tag: " $old
read -r -p "Are you sure? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
echo "Renaming tag"
git checkout tags/$old
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