🧹 A GitHub CLI extension that helps you clean up your forked repositories through an interactive interface.
- 🔍 Detects and warns about forks with open pull requests
- 📅 Shows last update time for each fork
- ✨ Interactive yes/no prompts for each repository
- 🔒 Safe deletion process using GitHub CLI
First, make sure you have the GitHub CLI installed and authenticated.
# Install the extension
gh extension install CodeWithEmad/gh-fork-cleanup
Important
Your GitHub token must have the delete_repo
scope to delete forks. If you're using GitHub CLI's
built-in authentication, ensure this scope is included. To add the scope to your existing token, run:
gh auth refresh -h github.com -s delete_repo
Simply run:
gh fork-cleanup [--force|-f] [--skip-confirmation|-s]
Options:
--force, -f
: It will automatically delete all forks. Be careful when using this option.--skip-confirmation, -s
: Skip the extra confirmation step for forks with open pull requests.
The extension will:
- Show a loading spinner while fetching your forks
- Check for any open pull requests from your forks
- List all your forked repositories with their last update times
- Warn you about forks that have open pull requests
- Ask if you want to delete each fork
- Process your choice (delete or skip)
Contributions are welcome! Feel free to open issues or submit pull requests.
MIT License - feel free to use and modify this code for your own projects.