finishing-a-development-branch

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

Updated Jul 22, 2026
One-click install
npx skills add https://github.com/johnstegeman/pi-packages --skill finishing-a-development-branch-johnstegeman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/johnstegeman/pi-packages/tree/main/packages/pi-superpowers-plus/skills/finishing-a-development-branch
Command: npx skills add https://github.com/johnstegeman/pi-packages --skill finishing-a-development-branch-johnstegeman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When implementation work is done, developers face a risky decision point: merge locally, open a pull request, or keep the branch — and doing it wrong can lose work, merge into the wrong base, or leave stale git worktrees behind. This Skill enforces a safe, consistent completion workflow. ## Core Features & Use Cases - Test-Gated Completion: Runs the full test suite first and stops if anything fails, so only green work gets integrated. - Environment-Aware Menus: Detects normal repos, named-branch worktrees, and detached HEAD states, then presents the correct merge/PR/keep options for each. - Safe Cleanup: Removes only worktrees under .worktrees/ or worktrees/, requires typed 'discard' confirmation before deleting work, and verifies merged results before deleting branches. - Use Case: After finishing a feature in a git worktree, invoke this Skill to verify tests, confirm the base branch, choose between a local merge or a GitHub PR, and clean up the worktree automatically. ## 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 merge locally and re-run tests on the merged result. Only delete the feature branch after the merged result passes.

How do I create a GitHub pull request from a git worktree?

Run any configured CI checks locally first, then push the branch with git push -u origin and create the PR against the base branch using the forge's CLI or the URL printed on push. Keep the worktree so PR feedback can be addressed there.

What happens to a git worktree after merging a branch?

Worktrees under .worktrees/ or worktrees/ are removed with git worktree remove followed by git worktree prune. Externally managed workspaces are left in place, and worktrees are always preserved when a pull request is created.

Can I discard a development branch and its worktree?

Discarding happens only on an explicit request and requires typing 'discard' to confirm. The branch is then force-deleted with git branch -D and the worktree removed, after showing the commits that will be lost.

What should I do when tests fail on the merged result?

Stop immediately and leave both the worktree and branch in place. Since nothing has been pushed, the merge is local and recoverable while you investigate the failure.