finishing-a-development-branch

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

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/farslab/claude-skills --skill finishing-a-development-branch-farslab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/farslab/claude-skills/tree/main/finishing-a-development-branch
Command: npx skills add https://github.com/farslab/claude-skills --skill finishing-a-development-branch-farslab

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers face a risky decision point: how to integrate the branch without losing work, merging into the wrong base, or destroying uncommitted files during worktree cleanup. This Skill enforces a safe, structured completion workflow. ## Core Features & Use Cases - Test-Gated Integration: Runs the full test suite before presenting any 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, or keep-as-is options. - 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 branch in a Git worktree, use this Skill to verify tests pass, choose between a local merge or a pull request, and clean up the worktree without losing uncommitted notes. ## Quick Start Use the finishing-a-development-branch skill to complete my current 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 clean up a Git worktree after merging?▼

Change to the main repo root, then run git worktree remove followed by git worktree prune. Only remove worktrees under .worktrees/ or worktrees/ directories; externally managed workspaces should be left 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. Never use --force on your own initiative; instead show the file list with git status --porcelain -uall and ask whether to commit, move, or delete them.

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 create the pull request against the base branch with the forge's CLI or the URL printed on push.

When is it safe to delete a development branch?▼

Delete a branch only after the merged result passes tests, using git branch -d for normal cleanup. Force deletion with git branch -D is reserved for explicit discard requests confirmed by typing the word discard.