| name | lazy-merge |
| description | Fetch and merge a GitHub PR locally for testing without pushing or closing the PR. Use when asked to locally merge a PR, test-merge a pull request, checkout and merge a PR for local testing, or pull a PR into a local branch. Accepts PR URLs, numbers (#14, 14), or gh references. Does NOT push to GitHub or close PRs. |
Lazy Merge — Local Test Merge Only
LOCAL MERGES ONLY — Does NOT push to GitHub or close PRs.
Input
Accepts: PR URL, #14, 14, or gh pr 14. If none provided, list PRs with gh pr list --limit 30.
Preconditions
git rev-parse --is-inside-work-tree
git remote -v
gh auth status
gh repo view --json name,owner
Verify ownership before proceeding. If not owned by user/org, ask how to proceed.
PR Inspection
gh pr view <number> --json number,title,headRefName,baseRefName,mergeable,state,isDraft,url
Validate:
- PR is open (not closed)
- PR is not a draft
- No merge conflicts (
mergeable != "CONFLICTING")
If blocking issues, warn and ask for confirmation.
Merge (LOCAL ONLY)
gh pr checkout <number>
git checkout <base-branch>
git merge --squash <pr-branch>
git commit -m "Local test merge of PR #<number>: <title>"
git merge <pr-branch> --no-ff -m "Local test merge of PR #<number>: <title>"
CRITICAL
- DO NOT run
git push
- DO NOT run
gh pr merge
- This is LOCAL ONLY for testing
Undo
git reset --hard origin/<base-branch>