finishing-a-development-branch

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

Updated May 8, 2026
One-click install
npx skills add https://github.com/tomw200082-collab/gt-factory-os-production-brain --skill finishing-a-development-branch-tomw200082-collab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/tomw200082-collab/gt-factory-os-production-brain/tree/main/.claude/skills/finishing-a-development-branch
Command: npx skills add https://github.com/tomw200082-collab/gt-factory-os-production-brain --skill finishing-a-development-branch-tomw200082-collab

SYSTEM DOCUMENTATION & REQUIREMENTS

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. Doing this ad hoc leads to untested merges, wrong base branches, orphaned worktrees, and accidental deletion of work. ## Core Features & Use Cases - Test-Gated Integration: Runs the full test suite before presenting any integration options, and re-verifies tests on the merged result before cleanup. - Environment-Aware Menus: Detects normal repos, named-branch worktrees, and detached HEAD states to present the correct merge/PR/keep options. - Safe Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, requires typed 'discard' confirmation before deleting anything, and never force-pushes without explicit request. - Use Case: After finishing a feature branch in a Git worktree, use this Skill to verify tests pass, confirm the base branch, create a pull request, and preserve the worktree for PR feedback iterations. ## Quick Start Use the finishing-a-development-branch skill to complete this branch now that all tests pass.

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 tests pass?▼

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 create a pull request from a Git worktree?▼

Push the feature branch with git push -u origin, then create the PR against the base branch using the forge's CLI or the URL printed on push. Keep the worktree in place so PR feedback can be addressed there.

Can I merge a branch from a detached HEAD state?▼

No, a detached HEAD in an externally managed workspace offers no local merge option. You can push as a new branch with git push origin HEAD:refs/heads/<new-branch> and open a pull request, or keep the state as-is.

When is it safe to remove a Git worktree?▼

Only remove worktrees located under .worktrees/ or worktrees/ directories, which indicates they were self-created. Run git worktree remove from the main repo root after a successful merge, followed by git worktree prune to clear stale registrations.

What happens if tests fail on the merged result?▼

The process stops immediately with the branch and worktree left in place. Since nothing has been pushed, the merge is local and recoverable while you investigate the failure.