finishing-a-development-branch

Guides merging, pushing, or discarding a completed development branch with test verification and worktree cleanup.

1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/maopujie10-sys/Bailongma --skill finishing-a-development-branch-maopujie10-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/maopujie10-sys/Bailongma/tree/main/src/skills/superpowers/finishing-a-development-branch
Command: npx skills add https://github.com/maopujie10-sys/Bailongma --skill finishing-a-development-branch-maopujie10-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers often face an ambiguous decision: 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 structured set of completion options with safe cleanup. ## Core Features & Use Cases - Test Gate Before Completion: Runs the project's test suite and blocks any merge or PR until all tests pass. - Environment Detection: Distinguishes normal repositories, named-branch worktrees, and detached HEAD states to present the correct option menu. - Structured Options: Presents exactly four choices (merge locally, push and create PR, keep as-is, discard) or three for detached HEAD, then executes the chosen workflow. - Safe Worktree Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, requires typed confirmation before discarding work, and runs git worktree prune after removal. - Use Case: After finishing a feature branch in a git worktree, invoke this Skill to verify tests, merge back to main, remove the worktree, and delete the branch in the correct order. ## Quick Start Ask the assistant to finish the current development branch and choose whether to merge it, open a pull request, keep it, or discard it.

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 finish a git feature branch after implementation is complete?

First verify the project's test suite passes, then choose one of four options: merge back to the base branch locally, push and create a pull request, keep the branch as-is, or discard the work. The Skill executes the chosen workflow including branch deletion and worktree cleanup.

How to safely remove a git worktree after merging a branch?

Change directory to the main repository root first, then run git worktree remove followed by git worktree prune. Only remove worktrees under .worktrees/ or worktrees/ that you created, and delete the branch only 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.

Does this workflow handle detached HEAD states in git?

Yes. When a detached HEAD is detected, the merge option is removed and only three choices are offered: push as a new branch with a pull request, keep as-is, or discard. No worktree cleanup is attempted since the workspace is externally managed.

When should I not clean up a worktree after finishing a branch?

Do not clean up when creating a pull request, since you need the worktree to iterate on review feedback, or when keeping the branch as-is. Also never remove worktrees created by an external harness rather than by your own workflow.