finishing-a-development-branch

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

1|Updated Aug 27, 2025
One-click install
npx skills add https://github.com/IgorGanapolsky/Random-Timer --skill finishing-a-development-branch-igorganapolsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/IgorGanapolsky/Random-Timer/tree/main/.cursor/skills/finishing-a-development-branch
Command: npx skills add https://github.com/IgorGanapolsky/Random-Timer --skill finishing-a-development-branch-igorganapolsky

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, lost uncommitted files in worktrees, and accidental deletion of work. ## Core Features & Use Cases - Test-Gated Integration: Runs the full test suite before any integration decision and re-verifies tests on the merged result. - Environment Detection: Distinguishes normal repositories, named-branch worktrees, and detached HEAD states to present the correct option menu. - 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, the assistant verifies tests pass, asks whether to merge to the base branch or open a PR, then cleans up the worktree without losing uncommitted notes. ## Quick Start Ask the assistant to finish the current development branch and decide how to integrate the completed work.

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 finished feature branch?

Run the full test suite first, confirm the base branch the work forked from, then check out the base, pull, and merge. Re-run tests on the merged result before deleting the feature branch or removing any worktree.

How do I clean up a git worktree after merging?

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 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 explicitly delete them. Never use --force without confirming with the user.

Can I merge or push from a detached HEAD state?

A detached HEAD cannot be merged back directly since there is no named branch. Instead, push it as a new branch with git push origin HEAD:refs/heads/<new-branch> and open a pull request, or keep the workspace as-is.

When should a development branch be discarded instead of merged?

Discarding should only happen when the user explicitly requests it, and only after a typed confirmation listing the branch, commits, and worktree to be deleted. The branch is then force-deleted with git branch -D after worktree cleanup.