finishing-a-development-branch

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

1|Updated May 3, 2021
One-click install
npx skills add https://github.com/leogurja/dotfiles --skill finishing-a-development-branch-leogurja
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/leogurja/dotfiles/tree/main/home/dot_agents/skills/finishing-a-development-branch
Command: npx skills add https://github.com/leogurja/dotfiles --skill finishing-a-development-branch-leogurja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done and tests pass, deciding how to integrate a development branch—merge locally, open a pull request, or keep it—often leads to inconsistent choices, lost worktrees, or accidentally deleted uncommitted files. 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, refuses to force-delete uncommitted files without explicit confirmation, and prunes stale registrations. - 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 finished feature branch in git?▼

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 cleaning up any worktree.

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

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 and ask whether to commit, move, or delete them before removing the worktree.

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.

When should a feature branch be deleted after merging?▼

Delete the branch with git branch -d only after the merged result passes the full test suite. If merged-result tests fail, leave the branch and worktree in place and investigate, since nothing has been pushed yet.