post-merged

Automate post-merge git cleanup with remote merge verification and safe branch deletion.

2|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/wilsonfaustino/ai-tools --skill post-merged
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: post-merged
Source: https://github.com/wilsonfaustino/ai-tools/tree/main/skills/post-merged
Command: npx skills add https://github.com/wilsonfaustino/ai-tools --skill post-merged

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

After merging a pull request, developers often leave behind messy local git state: unswitched branches, unpruned local feature branches, and unverified merge status, which can lead to accidental data loss or confusion in future work.

Core Features & Use Cases

  • Remote Merge Verification: Uses GitHub CLI to confirm PR merge status, correctly handling squash and rebase merges that break local ancestry checks.
  • Safe Default Branch Switching: Automatically detects the repository's default branch (no hardcoded main/master) and switches to it after pulling the latest changes with fast-forward only.
  • Guarded Local Branch Deletion: Prompts for explicit user consent before deleting the local feature branch, using safe delete flags that refuse to remove branches with unmerged work, and surfaces orphaned [gone] branches for manual cleanup.
  • Use Case: Immediately after shipping a feature branch PR, run this skill to automatically confirm the merge, update your local default branch, and clean up the old feature branch without risking lost work.

Quick Start

Use the post-merged skill right after you finish shipping a PR to handle all post-merge cleanup steps safely.

Frequently Asked Questions about post-merged

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

FAQPage Schema
How do I clean up local git branches after a pull request merge?

To clean up local git branches after a pull request merge, you need a workflow that verifies remote merge status, switches to the default branch, and safely deletes the feature branch. This prevents messy local git state and accidental data loss.

Why does git branch deletion fail after a squash merge?

Git branch deletion fails after a squash merge because squash merges break local ancestry checks, making Git think the branch is unmerged. Verifying the remote pull request merge status via GitHub CLI bypasses this local ancestry limitation.

How do I automatically switch to the default branch and pull latest changes after a PR merge?

You can automatically switch to the default branch and pull latest changes by detecting the repository's default branch dynamically without hardcoding main or master. Pulling with fast-forward only ensures a clean update to your local default branch.

What is the safest way to delete local feature branches without losing uncommitted work?

The safest way to delete local feature branches uses safe delete flags that refuse to remove branches with unmerged work. Prompting for explicit user consent before deletion and checking for a dirty working tree prevents accidental data loss.

Does post-merge cleanup work with repositories using non-standard default branch names?

Yes, post-merge cleanup works with repositories using non-standard default branch names by automatically detecting the repository's configured default branch. It avoids hardcoded main or master assumptions during default branch switching and deletion workflows.

What are the limitations of using GitHub CLI for post-merge git hygiene?

A limitation of using GitHub CLI for post-merge git hygiene is that it cannot automatically force-delete branches with unmerged work, requiring manual intervention. It also only surfaces orphaned gone branches for manual cleanup rather than removing them automatically.