Skip to content

Instantly share code, notes, and snippets.

@dearaujoj
Created November 17, 2014 13:33
Show Gist options
  • Select an option

  • Save dearaujoj/f36fb463c9d8cf19c16b to your computer and use it in GitHub Desktop.

Select an option

Save dearaujoj/f36fb463c9d8cf19c16b to your computer and use it in GitHub Desktop.

Revisions

  1. dearaujoj created this gist Nov 17, 2014.
    7 changes: 7 additions & 0 deletions delete-local-and-remote-tags
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #check tag with specific value
    for i in 2013 ; do git tag -l | grep "$i" ; git ls-remote --tags origin | awk '{print ":"$2}' | grep "$i" | grep -v '{}' ; done

    #delete local and remote tag with specific value
    for i in 2013 ; do git tag -l | grep "$i" | xargs git tag -d ; git ls-remote --tags origin | awk '{print ":"$2}' | grep "$i" | grep -v '{}' | xargs git push origin ; done

    #credits http://anavarre.net/2014/01/07/delete-local-and-remote-git-tags-programatically