Created
January 9, 2023 09:19
-
-
Save fhgbaguidi/9caebfe211ff33f3a89d0bb0ea368588 to your computer and use it in GitHub Desktop.
Delete all GitHub releases / tags
This file contains 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
# Install GH cli | |
https://github.com/cli/cli#installation | |
# set GH_TOKEN env var | |
export GH_TOKEN=<<your_PAT_with_repo_access>> | |
# delete releases | |
$ gh release list | sed 's/|/ /' | awk '{print $1, $8}' | while read -r line; do gh release delete -y "$line"; done | |
$ gh release # list gets a list of releases as a table. | |
$ sed 's/|/ /' | awk '{print $1, $8}' # singles out the first column provided by the table | |
$ while read -r line; do gh release delete -y "$line"; done # ran the delete command for each result | |
# delete remote tags | |
$ git fetch | |
$ git tag -l | xargs -n 1 git push --delete origin | |
# delete local tags | |
git tag -d $(git tag -l) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment