Last Updated: February 25, 2016
·
621
· phranck

Delete a git tag - made easy

Consistently I forget how to delete a git tag from a current project. That sux! So I wrote this shorty I want to share:

Ok, if you are using bash try this one:

git_remove_tag() {
    if [ ! -z "$1"  ]; then
        git tag -d "$1" && git push origin :refs/tags/$1
    fi
}
alias grt=git_remove_tag

Just paste the snippet above in your .profile or .bash_profile file.
To use it, in your terminal type in the alias followed by your tag;

Hal9000: MyAwesomeProject johndoe$ grt 0.5.1