git-merge-pr

Merge the current branch's GitHub pull request after verifying mergeability, CI status, and branch protection.

Updated Dec 18, 2025
One-click install
npx skills add https://github.com/l0lxl0lw/dotfiles --skill git-merge-pr-l0lxl0lw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-merge-pr
Source: https://github.com/l0lxl0lw/dotfiles/tree/main/ai/shared/skills/git/git-merge-pr
Command: npx skills add https://github.com/l0lxl0lw/dotfiles --skill git-merge-pr-l0lxl0lw

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Merging a pull request too early — while it is still a draft, has conflicts, has failing or pending CI, or is blocked by branch protection — puts broken code on the default branch. This Skill gates the merge behind a verified readiness check and a single explicit strategy choice, so nothing lands on the default branch until it is genuinely mergeable. ## Core Features & Use Cases - Mergeability verification: A read-only script checks PR state, draft status, conflicts, merge state, CI check rollup, and branch protection, returning a distinct exit code per blocker. - Explicit strategy selection: Asks once — merge commit, squash, rebase, or don't merge — with the PR number and title named in the dialog, and that choice authorizes the merge. - Safe merge execution: Re-confirms the PR is still OPEN before merging, never passes --admin to bypass branch protection, and never deletes the branch (cleanup is handed off separately). - Use Case: You finished a feature branch, the PR is approved, and you say "merge my PR". The Skill verifies CI is green, asks whether to squash or merge-commit, merges via gh pr merge, then offers to clean up the branch. ## Quick Start Ask the assistant to merge the pull request for the current branch, for example by saying "merge my PR", and it will verify readiness, ask for a merge strategy, and merge via the GitHub CLI.

Frequently Asked Questions about git-merge-pr

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 the gh CLI with gh pr merge <number> plus a strategy flag such as --merge, --squash, or --rebase. This Skill wraps that command with a readiness check that verifies the PR is open, not a draft, conflict-free, and passing CI before merging.

How do I check if a pull request is ready to merge?

Run the check-mergeable.sh script, which inspects PR state, draft status, mergeable flag, merge state, CI check rollup via gh pr checks, and branch protection. It exits 0 only when the PR is genuinely ready, with distinct exit codes for each blocker.

What is the difference between squash, merge, and rebase when merging a PR?

A merge commit preserves every branch commit plus a merge commit, squash collapses all branch commits into one commit on the default branch, and rebase replays each commit linearly with no merge commit. The Skill always asks which strategy to use and never assumes one.

Why does gh pr merge fail when branch protection is enabled?

Branch protection blocks merges when a required review or status check is missing, and gh pr merge fails accordingly. The Skill detects this BLOCKED state, reports it plainly, and refuses to pass --admin since bypassing protection is never automatic.

Can I merge a pull request while CI checks are still pending?

Pending checks are not passing checks, so the readiness script exits with a distinct code and stops the merge. You can wait for completion, watch with gh pr checks <n> --watch, or explicitly decide to proceed only if the user says so.

Does merging a PR automatically delete the branch?

No. The merge script deliberately omits --delete-branch so branch deletion happens in a separate cleanup step behind a verified MERGED state, which also refreshes the local default branch. Cleanup is offered after the merge but never run without confirmation.