I'm trying to delete a Release in GitHub, so I'm doing
git tag -d {release-tag-name}
git push origin :{release-tag-name}
This removes the tag (local and remote) but it leaves a Draft
release in GitHub that I also want to delete.
I can delete it by login into GitHub and clicking the delete button but I want to avoid doing this through the website.
Is there a command to achieve this? I've found some other similar postings about removing tags but they all end up going to GitHub to delete the Draft
.
Edit
In this question's accepted answer Step 2 and 5 are related to my question. Step 2 says This will turn your "Release" on GitHub into a Draft that you can later delete.
while step 5 instructs to delete the Draft in GitHub's site, not trough a command.
In order to delete a remote Git tag, use the “git push” command with the “–delete” option and specify the tag name. To delete a remote Git tag, you can also use the “git push” command and specify the tag name using the refs syntax.
A GitHub action that automatically drafts a GitHub release based on a newly created version tag. The commit messages between the created version tag and the one that came before it will become the release notes.
To delete the Git tag from the local repo, run the git tag -d tag-name command where tag-name is the name of the Git tag you want to delete. To get a list of Git tag names, run git tag.
Click Back to taggingClick the gear icon. Select Clear all tags from this page.
Releases are not something git CLI can help you with.
Releases are GitHub specific thing.
You can use GitHub API to create/update/delete releases.
DELETE /repos/:owner/:repo/releases/:id
If you want to automate interaction with GitHub API you can do the following:
For example in this case you can have one script to delete local tag, call API to get tag id by name, delete remote tag and delete a release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With