finishing-a-development-branch

Guides completion of development branches through structured merge, PR, or discard workflows.

3|Updated Sep 18, 2025
One-click install
npx skills add https://github.com/KingMichaelPark/dotfiles --skill finishing-a-development-branch-kingmichaelpark
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/KingMichaelPark/dotfiles/tree/main/ai/.agents/skills/finishing-a-development-branch
Command: npx skills add https://github.com/KingMichaelPark/dotfiles --skill finishing-a-development-branch-kingmichaelpark

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers often face an ambiguous decision point: merge locally, open a pull request, keep the branch, or discard it. This Skill removes that ambiguity by verifying tests first, detecting the git environment, and presenting a fixed set of structured options with safe execution and cleanup. ## Core Features & Use Cases - Test-Gated Completion: Runs the project's test suite before offering any options and refuses to proceed if tests fail. - Environment Detection: Distinguishes normal repositories, named-branch worktrees, and detached HEAD states to present the correct option menu. - Safe Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, requires typed confirmation before discarding work, and prunes stale worktree registrations. - Use Case: After finishing a feature branch in a git worktree, invoke this Skill to verify tests pass, choose "Merge back to main locally", and have the merge, worktree removal, and branch deletion executed in the correct order. ## Quick Start Ask the assistant to finish the current development branch and present the available completion options.

Frequently Asked Questions about finishing-a-development-branch

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

FAQPage Schema
How do I safely finish a git feature branch after implementation?

Verify the test suite passes first, then choose between merging locally, pushing and creating a pull request, keeping the branch, or discarding it. The Skill presents these as structured options and executes the chosen workflow with correct cleanup ordering.

How do I clean up a git worktree after merging a branch?

Change to the main repository root, run git worktree remove on the worktree path, then run git worktree prune to clear stale registrations. Only remove worktrees under .worktrees/ or worktrees/ that you created, and delete the branch after the worktree is removed.

What happens if tests fail before merging a branch?

The process stops immediately and reports the failing tests. No merge, pull request, or cleanup options are presented until all tests pass, preventing broken code from being integrated.

Can I merge a branch when HEAD is detached in a worktree?

No. In a detached HEAD state the merge option is unavailable because the workspace is externally managed. You can push as a new branch and create a pull request, keep the state as-is, or discard the work.

Why does git branch -d fail when a worktree still exists?

Git refuses to delete a branch that is checked out in an active worktree. Remove the worktree first with git worktree remove from the main repository root, then delete the branch.