finishing-a-development-branch

Guides merging, pushing, or preserving a completed development branch with verified tests and worktree cleanup.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, deciding how to integrate a feature branch is error-prone: tests may not have run on the final tree, merges can target the wrong base branch, and worktree cleanup can silently destroy uncommitted files. This Skill enforces a safe, repeatable completion workflow. ## Core Features & Use Cases - Test Verification Gate: Runs the project's full test suite (npm test, cargo test, pytest, go test) before any integration decision and stops on failure. - Environment Detection: Distinguishes normal repos, named-branch worktrees, and detached HEAD states to present the correct integration options. - Structured Integration Menu: Offers merge locally, push and create a pull request, or keep the branch as-is, with discard available only on explicit typed confirmation. - Safe Worktree Cleanup: Removes only self-created worktrees under .worktrees/ or worktrees/, and never force-removes worktrees containing uncommitted files without asking. - Use Case: After finishing a feature on a branch in a git worktree, use this Skill to verify tests pass, merge into the confirmed base branch, re-test the merged result, and clean up the worktree without losing uncommitted notes. ## Quick Start Ask the AI to finish the current development branch using the finishing-a-development-branch skill once 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 development is complete?

Run the full test suite first, confirm the base branch the work forked from, then checkout the base, pull, merge the feature branch, and re-run tests on the merged result. Only delete the branch after the merged tree is green.

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.

What should I do when git worktree remove is refused?

A refusal means the worktree contains modified or untracked files that exist nowhere else. List them with git status --porcelain -uall, then commit them, move them to the main repo, or delete them explicitly. Never use --force on your own initiative.

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 with the forge's CLI or the URL printed on push.

Why should tests run again after merging into the base branch?

A green run only proves the tree it ran on. The merged result combines your branch with the current base, so failures can appear that neither branch had alone. A failing merged result stops the workflow before anything is pushed.