pr-merge
Skill này làm gì
Skill này hướng dẫn người duy trì dự án rà soát và hợp nhất các đóng góp gửi qua pull request. Skill dành cho chủ dự án muốn người đóng góp được giữ nguyên ghi nhận.
Khi nào nên dùng
- ✓Khi bạn có nhiều pull request từ người đóng góp bên ngoài cần rà soát và hợp nhất.
- ✓Khi một pull request có xung đột hợp nhất và bạn muốn giải quyết mà không viết lại công việc của người đóng góp.
- ✓Khi bạn chỉ muốn hợp nhất một phần của pull request, chẳng hạn một tập file được chọn.
Liên kết skill
https://github.com/HKUDS/OpenHarness/blob/main/.claude/skills/pr-merge/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy xem các pull request đang mở trên repo của chúng tôi và hợp nhất những cái sạch, đồng thời giữ ghi nhận cho từng tác giả.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent liệt kê các pull request đang mở và phân loại chúng. Nó hợp nhất những cái sạch qua GitHub để giữ tác giả, còn với những cái khó hơn thì hợp nhất cục bộ và sửa xung đột trong một thay đổi riêng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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!"
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--authoror 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)
Câu hỏi thường gặp
Người đóng góp có còn được ghi nhận không?
Có. Skill ưu tiên hợp nhất qua GitHub và đặt tác giả khi hợp nhất thủ công, nên ghi nhận được giữ nguyên.
Nó có viết lại mã của người đóng góp không?
Không. Skill nói rằng trước hết chấp nhận cách tiếp cận của người đóng góp, còn xung đột được sửa sau trong một commit riêng.
Tôi có thể chỉ hợp nhất một số file từ pull request không?
Có. Skill cho phép hợp nhất có chọn lọc, bỏ qua các file đã được triển khai cục bộ, và yêu cầu bạn ghi lại những gì đã bị bỏ qua.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 16k
- Vị trí xếp hạng
- #10803
- Giấy phép
- MIT
- Cập nhật
- 3/6/2026
Bình luận
- …
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.