Skip to content
Skillpedia
Deploy & cloud (DevOps)16k Β· #10803

pr-merge

What it does

This skill guides a maintainer through reviewing and merging contributions sent as pull requests. It is for project owners who want contributors to keep their credit.

When to use it

  • βœ“When you have several open pull requests from outside contributors to review and merge.
  • βœ“When a pull request has merge conflicts and you want to resolve them without rewriting the contributor's work.
  • βœ“When you only want part of a pull request merged, such as a selected set of files.

Skill link

https://github.com/HKUDS/OpenHarness/blob/main/.claude/skills/pr-merge/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/HKUDS/OpenHarness/blob/main/.claude/skills/pr-merge/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œPlease go through the open pull requests on our repo and merge the clean ones while keeping each author credited.”

5 new skills a week. 1 minute to read.

How it works

The agent lists the open pull requests and sorts them. It merges the clean ones through GitHub so the author is kept, and for harder ones it merges locally and fixes conflicts in a separate change.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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

  1. Preserve authorship β€” use gh pr merge --squash for clean PRs. For manual merges, use --author="Name <email>".
  2. Merge first, fix after β€” accept the PR's approach even if it differs from local style. Fix conflicts in a separate commit.
  3. Selective merge is OK β€” exclude files with --exclude when a PR contains features already implemented locally. Document what was excluded.
  4. 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!"

6. Post-Merge Verification

python -m ruff check src/ tests/    # lint
python -m pytest tests/ -q          # unit tests
git push origin main                # push

Then run harness-eval for end-to-end verification on an unfamiliar codebase.

Attribution Checklist

Before pushing a merged PR:

  • Original author appears in git log (via --author or GitHub squash merge)
  • Commit message references PR number (#NUMBER)
  • If selectively merged, commit body explains exclusions
  • Closed PRs have a comment thanking the contributor
  • Duplicate PRs acknowledge the contributor's investigation

Common Pitfalls

  • git apply + self-commit loses author
  • Rewriting from scratch instead of merging β€” merge their code, fix style after
  • Force-pushing main after merge β€” may remove contributor commits
  • Forgetting CHANGELOG conflicts β€” always exclude and handle manually
  • Not testing after merge β€” clean merge doesn't mean working code

Additional Resources

Reference Files

  • references/merge-scenarios.md β€” Detailed examples for each merge scenario (clean, conflicting, selective, duplicate)
FAQ

Will the contributor still get credit?

Yes. The skill prefers GitHub merges and sets the author when merging by hand, so credit is kept.

Does it rewrite the contributor's code?

No. The skill says to accept the contributor's approach first and fix any conflicts afterwards in a separate commit.

Can I merge only some files from a pull request?

Yes. The skill allows a selective merge that leaves out files already implemented locally, and asks you to note what was left out.

Details

Original description by the author

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.

repo: HKUDS/OpenHarness

Popularity

GitHub stars
16k
Ranking position
#10803
License
MIT
Updated
6/3/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

Similar skills