merge-pr

Squash-merge GitHub PRs via gh pr merge and verify MERGED state.

30|5|Updated Jul 25, 2025
One-click install
npx skills add https://github.com/phuetz/code-buddy --skill merge-pr-phuetz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: merge-pr
Source: https://github.com/phuetz/code-buddy/tree/main/.codebuddy/skills/bundled/merge-pr
Command: npx skills add https://github.com/phuetz/code-buddy --skill merge-pr-phuetz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates a reliable merge workflow for prepared GitHub PRs by squash merging and enforcing safe post-merge cleanup, preventing unintended pushes to main or code changes.

Core Features & Use Cases

  • Squash merge: Execute a squash merge via gh pr merge --squash to consolidate commits.
  • Pre-merge validation: Ensure PR is OPEN, not a draft, and required checks pass before merge.
  • Post-merge cleanup: Delete the head branch and verify MERGED state to maintain repo hygiene.
  • Use Case: A maintainer wants to finalize a reviewed PR without polluting history.

Quick Start

Use the merge-pr skill to squash-merge PR #<number> with gh pr merge <number> --squash --delete-branch and verify success.

Frequently Asked Questions about merge-pr

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

FAQPage Schema
How do I safely squash and merge a GitHub PR from the command line?

To safely squash and merge a GitHub PR, use the gh pr merge --squash command to consolidate commits and verify the PR reaches a MERGED state to maintain repository hygiene.

What is the safest way to automate GitHub PR merges and branch cleanup?

Automating GitHub PR merges safely requires enforcing pre-merge checks to ensure the PR is OPEN and not a draft, executing a squash merge, and deleting the head branch for post-merge cleanup.

How does a squash merge keep my git history clean when merging GitHub PRs?

A squash merge consolidates all commits from a GitHub PR into a single commit before applying it to the main branch, preventing commit pollution while ensuring the PR reaches the MERGED state.

Does the GitHub squash merge workflow prevent direct pushes to the main branch?

Yes, a safe GitHub squash merge workflow explicitly disallows direct pushes to the main branch and enforces using gh pr merge --squash to prevent unintended code changes or history pollution.

What pre-merge validation is required before squashing and merging a GitHub PR?

Before squashing and merging a GitHub PR, pre-merge validation must verify that the PR is OPEN, is not marked as a draft, and that all required CI checks have successfully passed.