https://github.com/codewithemad/gh-fork-cleanup
GitHub CLI extension to help you clean up your fork repositories
https://github.com/codewithemad/gh-fork-cleanup
Last synced: 10 months ago
JSON representation
GitHub CLI extension to help you clean up your fork repositories
- Host: GitHub
- URL: https://github.com/codewithemad/gh-fork-cleanup
- Owner: CodeWithEmad
- License: mit
- Created: 2025-03-09T18:59:55.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-08-11T12:51:00.000Z (10 months ago)
- Last Synced: 2025-08-16T23:02:18.038Z (10 months ago)
- Language: Go
- Homepage:
- Size: 49.8 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Fork Cleanup
๐งน A GitHub CLI extension that helps you clean up your forked repositories through an interactive interface.

## Features
- ๐ Detects and warns about forks with open pull requests
- ๐ Shows commit comparison with parent repository
- ๐ฆ Identifies archived repositories
- ๐
Shows last update time for each fork
- โจ Interactive yes/no prompts for each repository
- ๐ Safe deletion process using GitHub CLI
- ๐ Open fork URLs directly in your browser
## Installation
First, make sure you have the [GitHub CLI](https://cli.github.com/) installed and authenticated.
```bash
# 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:
>
> ```bash
> gh auth refresh -h github.com -s delete_repo
> ```
## Usage
Simply run:
```bash
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:
1. Show a loading spinner while fetching your forks
2. Check for any open pull requests from your forks
3. List all your forked repositories with their last update times
4. Warn you about forks that have open pull requests
5. Ask if you want to delete each fork
6. Process your choice (delete or skip)
## Development
1. Fork and clone the repository
```bash
gh repo fork CodeWithEmad/gh-fork-cleanup # or just use Github website
git@github.com:YOUR_USERNAME/gh-fork-cleanup.git
```
2. Make your changes to the code
3. Build the executable
```bash
go build -o gh-fork-cleanup
```
and enjoy hacking!
## Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
## License
MIT License - feel free to use and modify this code for your own projects.