I wanted to clean out the releases I had in a GitHub repo. Googled around and ended up using this command since i already had the GitHub CLI installed.
If you do not already have the GitHub CLI installed, check out the repo (https://github.com/cli/cli) for instructions.
The command:
$ 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.
Result:
✓ Deleted release darwin-75c5ae281acc12eb95445162d0bc0f73dcc51ace
✓ Deleted release darwin-8d25e0f94558b753f8d58509ca03cbe6e0c86cab
✓ Deleted release darwin-e0a28dd3b2df98f48e30fd851a4e1ef9990ed7b3
✓ Deleted release darwin-3f3aa570acd185016cb11d5aecc61749fd907d6f
✓ Deleted release darwin-37c8382ef2e1e170642f24d45a31c5c3e9004084
✓ Deleted release darwin-d41e9be524b62be4b30ea7786592851f949dda5d
✓ Deleted release darwin-b57896ec7121e59c32e5f62e39bee5cb1edd42be
✓ Deleted release darwin-7849de58c872a2decf43e520ec42b804f41d85f3
✓ Deleted release darwin-07df533961c2d8cfd34245672f7d9ff16f6bb8e6
✓ Deleted release darwin-870a61ff358d7bbc5d97b290ffd32be1501bbddb
✓ Deleted release darwin-21de7c7db92d4d5add9f7539f2ba2993f2d41cd2
✓ Deleted release linux-master
✓ Deleted release linux-21de7c7db92d4d5add9f7539f2ba2993f2d41cd2
✓ Deleted release windows-21de7c7db92d4d5add9f7539f2ba2993f2d41cd2
✓ Deleted release linux-12542d8ae15ac6c3a28a3bb8da7ae297bb0e69a0
✓ Deleted release windows-12542d8ae15ac6c3a28a3bb8da7ae297bb0e69a0
✓ Deleted release linux-99ce7f2f6eaae14dfb5d491888115b1fd71d998a
✓ Deleted release windows-99ce7f2f6eaae14dfb5d491888115b1fd71d998a
✓ Deleted release windows-3acd65caf2f6ea063feba12861eea021fe9f506e
✓ Deleted release linux-a2054c7f47352884edcdbd4777f66b416563b980
✓ Deleted release windows-a2054c7f47352884edcdbd4777f66b416563b980
✓ Deleted release linux-65103ccc3b98cfcf553220bc193e2383e6047169
✓ Deleted release windows-65103ccc3b98cfcf553220bc193e2383e6047169
✓ Deleted release windows-1f435af0cfaa7bd2d4f026b34ceaeaf671eb0a51
✓ Deleted release linux-ca6f22638afc0985245a95ad799fe6b0a38a6477
✓ Deleted release windows-ca6f22638afc0985245a95ad799fe6b0a38a6477
✓ Deleted release windows-d59c68d12992765781c8803c79213cbae6e6155b
After deleting all of the releases I had to also get rid of all the tags. This command did that for me.
$ git fetch
$ git tag -l | xargs -n 1 git push --delete origin
Top comments (1)
the command didn't work for me. this did.