Created
December 16, 2014 08:00
-
-
Save cpetschnig/c2dfbc7a4890635bd362 to your computer and use it in GitHub Desktop.
Git tag operations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fetch remote tags: | |
$ git fetch --tags origin | |
# list all remote tags: | |
$ git ls-remote --tags | |
# list all major version tags: | |
$ git ls-remote --tags | grep -oe "refs/tags[^\^]*" | uniq | grep -E "v2[0-9][0-9][0-9]-[0-9][0-9]$" | |
# delete all non-version tags: | |
$ git ls-remote --tags | grep -oe "refs/tags[^\^]*" | uniq | grep -vE "v2[0-9][0-9][0-9]-[0-9][0-9]" | xargs git push --delete origin | |
# delete all RCs: | |
$ git ls-remote --tags | grep -oe "refs/tags[^\^]*" | uniq | grep -E "v[0-9][0-9][0-9][0-9]-[0-9][0-9].*rc[0-9][0-9]$" | xargs git push --delete origin | |
# only keep tags locally that are remote: | |
$ git tag -l | xargs git tag -d && git fetch --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment