Collection of utility scripts for development workflows.
Delete branches from closed pull requests on GitHub.
Usage:
./gh-cleanup-branches [OPTIONS] owner/repoOptions:
--dry-run- Show what would be deleted without actually deleting--unmerged-only- Only delete branches from unmerged PRs (default: delete all closed PRs)--limit N- Maximum number of PRs to fetch (default: 100000)-h, --help- Show help message
Examples:
# Dry run to preview deletions
./gh-cleanup-branches --dry-run AriehSchneier/my-repo
# Delete only unmerged PR branches
./gh-cleanup-branches --unmerged-only AriehSchneier/my-repo
# Delete all closed PR branches
./gh-cleanup-branches AriehSchneier/my-repo
# Limit to 500 most recent closed PRs
./gh-cleanup-branches --limit 500 AriehSchneier/my-repoRequirements:
gh(GitHub CLI)jqgit
Clone this repository and add it to your PATH:
git clone https://github.com/AriehSchneier/scripts.git ~/scripts
echo 'export PATH="$HOME/scripts:$PATH"' >> ~/.zshrc
source ~/.zshrc