Ever find yourself moving a git tag to a new commit? You’ll probably know this procedure consists out of three steps;
- Removing the existing tag from your
origin
- Manually moving the tag (using
-f
to allow moving) - Pushing the tag back your
origin
Since this procedure is more cumbersome that it could be, behold, a quick and easy life hack to automate this process into a single custom command.
Before you start
- Make sure you have a
$HOME/bin
directory - Make sure that directory is in your
PATH
The script
- Put this script in your
$HOME/bin
directory:
- Make it executable by running
chmod u+x $HOME/bin/git-retag
- Enjoy!