Skip to content

Instantly share code, notes, and snippets.

@dev-AshishRanjan
Created December 29, 2025 13:24
Show Gist options
  • Select an option

  • Save dev-AshishRanjan/1a910495932893383efb415dc24c71ba to your computer and use it in GitHub Desktop.

Select an option

Save dev-AshishRanjan/1a910495932893383efb415dc24c71ba to your computer and use it in GitHub Desktop.
Delete all tags and releases of a github repo, works on every system

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).

Method 1: The "Cleanest" Way (Releases + Tags)

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.

  1. Open PowerShell or Terminal in your repo folder.
  2. 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.

Method 2: The "Git Only" Way (Tags Only)

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 $_ }

Important Warning

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment