
PR Merge
Should be used when the user asks to "merge a PR", "review and merge pull requests"...
Install
npx skills add HKUDS/OpenHarness --skill pr-merge -g -a claude-code -y- Repository
- HKUDS/OpenHarness16.1k
- Category
- Git and review
- Updated
- 5mo ago
- License
- MIT
- Context cost
- Lightabout 770 tokens
- Runs scripts
- No, instructions only
What it does
This skill should be used when the user asks to "merge a PR", "review and merge pull requests", "integrate external contributions", "handle PR conflicts", "cherry-pick from a PR", or needs to merge GitHub PRs while maximizing contributor attribution.
PR Merge, Contributor-First Pull Request Integration
Merge external pull requests while maximizing original author attribution. Core principle: merge first, resolve conflicts after, never rewrite a contributor's work from scratch.
Core Principles
- Preserve authorship, use
gh pr merge --squashfor clean PRs. For manual merges, use--author="Name <email>". - Merge first, fix after, accept the PR's approach even if it differs from local style. Fix conflicts in a separate commit.
- Selective merge is OK, exclude files with
--excludewhen a PR contains features already implemented locally. Document what was excluded. - Never
git apply+ self-commit, this loses author attribution entirely.
Workflow
1. Triage Open PRs
gh pr list --repo OWNER/REPO --state open \
--json number,title,author,additions,deletions,mergeable
Classify each PR: merge directly, merge with conflict resolution, selective merge, or close.
2. Merge Clean PRs via GitHub
Prefer gh pr merge, preserves author automatically:
gh pr merge NUMBER --repo OWNER/REPO --squash \
--subject "feat: description (#NUMBER)"
3. Handle Conflicting PRs Locally
git fetch origin pull/NUMBER/head:pr-NUMBER
git merge pr-NUMBER --no-edit
# Resolve conflicts keeping both sides where possible
git add -A && git commit --no-edit
4. Selective Merge (Skip Some Files)
When a PR contains features already implemented locally:
gh pr diff NUMBER --repo OWNER/REPO | \
git apply --exclude='path/to/skip.py' --exclude='CHANGELOG.md'
git commit --author="Author Name <author@email>" \
-m "feat: description (#NUMBER)
Cherry-picked from PR #NUMBER. Excluded: file.py (already implemented)."
5. Close Duplicate/Superseded PRs
gh pr close NUMBER --repo OWNER/REPO \
--comment "Fixed via PR #OTHER. Thank you for the contribution!"

