finishing-a-development-branch

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, deciding how to integrate a development branch is error-prone: tests may not have been re-run, the base branch may be wrong, and git worktrees may be left behind or deleted prematurely. This Skill enforces a safe, repeatable completion workflow. ## Core Features & Use Cases - Test Gate Before Integration: Runs the project's full test suite (npm test, cargo test, pytest, go test) and stops if anything fails before offering integration options. - Environment Detection: Distinguishes normal repositories, named-branch worktrees, and detached HEAD states to present the correct merge, pull request, or keep-as-is options. - Safe Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, deletes branches only after a green merged result, and requires typed confirmation before discarding work. - Use Case: After finishing a feature branch in a git worktree, use this Skill to verify tests, merge back to the base branch, confirm the merged result passes, and clean up the worktree and branch. ## 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?

First run the full test suite and stop if anything fails. Then confirm the base branch, check out the base, pull, merge the feature branch, and re-run tests on the merged result before deleting the branch.

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

Change directory to the main repository 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 tests fail on the merged result?

Stop immediately and leave the worktree and branch in place. Since nothing has been pushed, the merge is local and recoverable, so investigate the failure before attempting any cleanup or branch deletion.

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 the full test suite, using git branch -d. Force-deletion with git branch -D is reserved for explicitly confirmed discards where the user types the word discard.