finishing-a-development-branch

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

Updated Oct 16, 2025
One-click install
npx skills add https://github.com/hugotown/dotfiles --skill finishing-a-development-branch-hugotown
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/hugotown/dotfiles/tree/main/agents/skills/finishing-a-development-branch
Command: npx skills add https://github.com/hugotown/dotfiles --skill finishing-a-development-branch-hugotown

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done and tests pass, deciding how to integrate the branch—merge locally, open a pull request, or keep it—often leads to inconsistent cleanup, lost uncommitted files, or merges into the wrong base branch. This Skill enforces a safe, repeatable completion workflow. ## Core Features & Use Cases - Test-Gated Integration: 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 to present the correct merge/PR/keep options. - Safe Worktree Cleanup: Removes only self-created worktrees under .worktrees/, refuses to force-delete uncommitted files, and requires typed confirmation before discarding work. - Use Case: After finishing a feature in a git worktree, use this Skill to verify tests, merge into the confirmed base branch, re-test the merged result, and clean up the worktree without losing scratch files. ## 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 remove 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 tooling created; leave externally managed workspaces in place.

Why does git worktree remove refuse with modified or untracked files?▼

The refusal means the worktree contains files that exist nowhere else, such as uncommitted plans or scratch notes. Never use --force; instead commit the files, move them to the main repo, or explicitly choose to 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 open the pull request against the base branch. Merging locally is not offered in detached HEAD workspaces.

When should I discard a development branch instead of merging?▼

Discard only when explicitly requested, and require typed confirmation of the word discard after listing the branch, commits, and worktree that will be permanently deleted. Then remove the worktree and force-delete the branch with git branch -D.