gitmyhub

delete-github-forks

TypeScript ★ 237 updated 13h ago

Bulk delete your GitHub forks

Delete GitHub Forks is a small utility for cleaning up forked repositories on your GitHub account. When you contribute to open-source projects, GitHub creates a copy of the original repository in your account called a fork. Over time, these forks accumulate and become clutter, but deleting them one by one through the GitHub website is tedious because you have to type your password and the repository name for each deletion.

This tool solves that problem in two steps. First, you run a command that fetches a list of all your forked repositories and saves it to a local file. You then open that file, review the list, and manually remove any forks you want to keep. Whatever remains in the file will be deleted in the second step.

The second step runs a delete command that reads the file and removes all the listed repositories from your GitHub account through the GitHub API. The README explicitly warns that this operation cannot be undone, so reviewing the file carefully before running the second command is important.

Setup requires adding your GitHub username and an access token to a configuration file. The token needs two specific permissions: one to access your repositories and one to delete them.

The project is simple by design. It does one thing and takes only a few minutes to run. The README notes that the scripts could be adapted to work on organization repositories as well, though that is not built in by default.