finishing-a-development-branch

Guides merging, pushing, or preserving a completed development branch with worktree cleanup.

1|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/stefaniuk/loadout --skill finishing-a-development-branch-stefaniuk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/stefaniuk/loadout/tree/main/.github/skills/finishing-a-development-branch
Command: npx skills add https://github.com/stefaniuk/loadout --skill finishing-a-development-branch-stefaniuk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done and tests pass, developers still face a risky decision: how to integrate the branch without losing work, merging into the wrong base, or destroying uncommitted files in a worktree. This Skill enforces a safe, repeatable finish workflow. ## Core Features & Use Cases - Test-Gated Integration: Runs the full test suite first and stops if anything fails, so only green work gets integrated. - Environment-Aware Options: Detects normal repos, named-branch worktrees, and detached HEAD states, then presents the correct merge, pull request, or keep-as-is menu. - Safe Worktree Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, refuses forced deletion of uncommitted files, and requires typed confirmation before discarding work. - Use Case: After finishing a feature in a Git worktree, use this Skill to verify tests, merge back to the base branch, re-run tests on the merged result, and clean up the worktree and branch. ## Quick Start Ask the assistant to finish the current development branch using this skill once all tests pass, then choose whether to merge locally, open a pull request, or keep the branch. ## Quick Start Note This skill is guarded for the superpowers workflow mode; run ./scripts/hooks/workflow-mode.sh status first.

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 merge a finished feature branch back into the base branch?▼

Run the full test suite first, confirm the base branch, then check out the base, pull, and merge the feature branch. Re-run tests on the merged result before deleting the branch or cleaning up any worktree.

How do I clean up a Git worktree after merging a branch?▼

Change to the main repo root, then run git worktree remove followed by git worktree prune. Only remove worktrees under .worktrees/ or worktrees/ that your own workflow created; leave externally managed workspaces in place.

What should I do when git worktree remove is refused?▼

A refusal means the worktree contains modified or untracked files that exist nowhere else. List them with git status --porcelain -uall, then commit, move, or explicitly delete them before retrying removal; never use --force on your own initiative.

Can I create a pull request from a detached HEAD state?▼

Yes. Push with git push origin HEAD:refs/heads/<new-branch> to name a new branch on the remote, then open the pull request against the base branch using the forge's CLI or the URL printed after pushing.

When should I not delete a development branch or worktree?▼

Keep the worktree when a pull request is open, since review feedback is iterated there. Also keep everything in place if merged-result tests fail, and never discard work without an explicit typed confirmation.