pr-merge

Merge a GitHub pull request via gh and return to the updated base branch.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/real-case/marvin-toolkit --skill pr-merge-real-case
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pr-merge
Source: https://github.com/real-case/marvin-toolkit/tree/main/plugins/marvin/skills/pr-merge
Command: npx skills add https://github.com/real-case/marvin-toolkit --skill pr-merge-real-case

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Merging a pull request involves several manual steps — checking mergeability, confirming reviews and checks, merging, deleting the branch, and switching back to the base branch — and skipping any of them leaves a stale or dirty working copy. ## Core Features & Use Cases - Pre-flight merge readiness check: Inspects PR state, draft status, merge conflicts, check results, and review decisions via gh pr view before merging. - Confirmed merge with branch cleanup: Merges using the repository's default merge method through gh pr merge --delete-branch after explicit user approval, never bypassing branch protection. - Automatic return to base branch: Checks out the PR's base branch (e.g., dev) and pulls the latest changes so work can continue immediately. - Use Case: After a feature PR passes review, run the skill to merge PR #42, delete the feature branch, and land back on an up-to-date dev branch in one flow. ## Quick Start Ask the assistant to merge PR #42 and switch back to the base branch with the merge pulled in.

Frequently Asked Questions about pr-merge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I merge a GitHub pull request from the command line?▼

Use gh pr merge with the PR number to merge via the repository's default method (merge, squash, or rebase). Adding --delete-branch removes the remote head branch, and the skill then checks out the base branch and pulls the merge.

How to check if a pull request is mergeable before merging?▼

Run gh pr view with the mergeable, mergeStateStatus, and reviewDecision fields. This surfaces conflicts, pending or failing checks, and missing reviews so you can decide whether to proceed or stop.

Can I merge a draft or closed pull request with gh?▼

No. The skill refuses to merge a PR whose state is not OPEN or whose isDraft flag is true. You must mark the PR ready for review first, then rerun the merge.

What happens if merging is blocked by branch protection rules?▼

The merge is reported as blocked and not forced. Required checks or reviews must be satisfied first; the skill never bypasses branch protection or uses admin overrides.

Why does switching back to the base branch fail after merging?▼

A dirty working tree blocks git checkout of the base branch. The skill stops and asks rather than stashing or discarding uncommitted changes, so commit or stash your work manually before retrying.