ghprmerge
Purpose
ghprmerge solves the problem of merging many similar pull requests across a GitHub organization. When you have dozens or hundreds of repositories with Dependabot (or similar automated) PRs, manually reviewing and merging each one becomes impractical.
Safety Model
ghprmerge is designed to be safe by default:
- Default is analysis only - Without explicit
--rebaseor--mergeflags, the tool only scans and reports what it would do - Explicit action flags - Use
--rebaseto update branches,--mergeto merge PRs, or--merge --skip-rebaseto merge without requiring up-to-date branches - Strict readiness checks - A PR is only considered ready if:
- All check runs have a successful conclusion (including non-required checks)
- All commit status contexts are successful
- No merge conflicts
- Branch is fully up to date with the default branch (unless
--skip-rebaseis used)
- Sequential processing - Repositories are processed one at a time, never in parallel
- No local checkout - All operations use the GitHub API
Non-Goals
- No local git operations or repository checkouts
- No parallel repository operations
- No creating or approving pull requests
- No modifying repository settings
Execution Flow
scan → evaluate → optional rebase → optional merge → report
For each repository (processed sequentially):
- Fetch repository metadata including default branch
- Enumerate candidate PRs matching
--source-branchpattern - For each candidate PR:
- Evaluate readiness (checks, conflicts, branch status)
- If
--rebase: update branch if behind - If
--mergeand PR is valid: attempt merge - If
--merge --skip-rebase: attempt merge even if branch is behind - Record result immediately
- Print per-repository summary
Contents
- USAGE.md - Complete command-line reference with flag table
- EXAMPLES.md - Practical example commands and workflows
- INSTALL.md - Installation instructions