AriehSchneier/scripts

★ 0Forks 0ShellGitHub ↗Compare

README

Personal Scripts

Collection of utility scripts for development workflows.

Scripts

gh-cleanup-branches

Delete branches from closed pull requests on GitHub.

Usage:

./gh-cleanup-branches [OPTIONS] owner/repo

Options:

  • --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-repo

Requirements:

  • gh (GitHub CLI)
  • jq
  • git

Installation

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

Contributors

AriehSchneier

Issues