finishing-a-development-branch

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

Updated Aug 20, 2026
One-click install
npx skills add https://github.com/Pega88/agy-superpowers --skill finishing-a-development-branch-pega88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/Pega88/agy-superpowers/tree/main/.agents/plugins/superpowers/skills/finishing-a-development-branch
Command: npx skills add https://github.com/Pega88/agy-superpowers --skill finishing-a-development-branch-pega88

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done and tests pass, developers face an error-prone decision point: how to integrate the branch, whether to open a pull request, and how to clean up git worktrees without losing uncommitted files. This Skill provides a disciplined, step-by-step procedure that prevents premature merges, accidental data loss, and forgotten cleanup. ## Core Features & Use Cases - Test-Gated Integration: Runs the full test suite first and blocks any merge or PR until the suite is green, including re-verifying tests on the merged result. - Environment-Aware Menus: Detects normal repos, named-branch worktrees, and detached HEAD states via git-dir comparison, then presents the correct integration options (merge locally, push and create PR, or keep as-is). - Safe Worktree Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, refuses forced deletion when uncommitted files exist, and requires explicit typed confirmation before discarding work. - Use Case: After finishing a feature in an isolated git worktree, use this Skill to verify tests, confirm the base branch, present integration options to the user, and clean up the worktree only after a successful local merge. ## Quick Start Use the finishing-a-development-branch skill to verify my tests and help me integrate this completed feature branch.

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 feature branch after development is complete?

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

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

Change directory 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 tooling 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 without user approval.

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

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

When should a feature branch be deleted after merging?

Delete the branch with git branch -d only after the merged result passes the full test suite and any worktree cleanup is complete. If merged-result tests fail, leave the branch and worktree in place while investigating.