finishing-a-development-branch

Guides merging, pushing, or keeping a completed Git branch with worktree cleanup.

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/kangjuhyup/study --skill finishing-a-development-branch-kangjuhyup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/kangjuhyup/study/tree/main/scoped-superpowers-ab/workflow-code-benchmark/fixture/workflows/full/skills/finishing-a-development-branch
Command: npx skills add https://github.com/kangjuhyup/study --skill finishing-a-development-branch-kangjuhyup

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 Git hygiene, 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/ or 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 and branch without losing scratch files. ## Quick Start Ask the AI to finish the current development branch by verifying tests and presenting merge, pull request, or keep options.

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 checkout 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?

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. Never use --force on your own initiative; instead list the files with git status --porcelain -uall and ask whether to commit, move, or delete them.

Can I create a pull request from a detached HEAD state?

Yes, push the detached HEAD to a named remote branch using git push origin HEAD:refs/heads/<new-branch>, then open the pull request against the base branch. Local merging is not offered in detached HEAD workspaces.

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 and any worktree cleanup is complete. If merged-result tests fail, leave the branch and worktree in place while investigating.