Delete all tags and releases of a github repo, works on every system
This is best done using PowerShell on Windows. The most reliable method is using the GitHub CLI because standard Git commands often delete the tag but leave a "draft" or broken release entry behind in the GitHub UI. Here are the two methods (choose one).
Requires: GitHub CLI installed (gh).
This is the preferred method because it deletes the Release entry and the underlying Tag simultaneously, ensuring no "ghost" releases are left behind.
- Open PowerShell or Terminal in your repo folder.
- Run this single command to delete all releases and their associated tags:
gh release list --limit 1000 --json tagName --jq '.[].tagName' | ForEach-Object { gh release delete $_ --cleanup-tag -y }
- How it works:
gh release list --limit 1000: Fetches up to 1000 releases.--json tagName --jq ...: extracts just the tag names cleanly.--cleanup-tag: Deletes the git tag along with the release.-y: Skips the "Are you sure?" confirmation for every single one.
Requires: Git only (no extra tools). Use this if you only have tags (no formal "Releases" created in the GitHub UI) or if you cannot install the GitHub CLI.
Step 1: Delete Remote Tags (Github.com) Run this in PowerShell to push delete commands for every tag:
git tag | ForEach-Object { git push origin --delete $_ }
(Note: If you have hundreds of tags, this may take a while as it pushes one deletion at a time.)
Step 2: Delete Local Tags Once the remote is clean, clean up your local machine:
git tag | ForEach-Object { git tag -d $_ }
These commands are destructive and irreversible.
If you delete a release/tag that others rely on (e.g.,
v1.0), their builds may break. Ensure you are in the correct repository before running these.