finishing-a-development-branch

Guides merging, pull request creation, or cleanup of completed git development branches.

3|1|Updated May 29, 2026
One-click install
npx skills add https://github.com/mambo-wang/CodingHub --skill finishing-a-development-branch-mambo-wang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/mambo-wang/CodingHub/tree/main/.qoder/skills/finishing-a-development-branch
Command: npx skills add https://github.com/mambo-wang/CodingHub --skill finishing-a-development-branch-mambo-wang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When a feature implementation is done and tests pass, developers often face an ambiguous decision about how to integrate the work—merge locally, open a pull request, keep the branch, or discard it. This Skill removes that ambiguity by verifying tests, detecting the git environment (normal repo, worktree, or detached HEAD), and presenting structured options with safe execution and cleanup. ## Core Features & Use Cases - Test-Gated Integration: Runs the project test suite before offering any merge or PR option, and blocks progress if tests fail. - Environment-Aware Menus: Detects normal repositories, named-branch worktrees, and detached HEAD states to present the correct set of options. - Safe Worktree Cleanup: Removes only self-created worktrees (under .worktrees/ or similar paths), prunes stale registrations, and never deletes harness-managed workspaces. - Use Case: After finishing a feature branch in a git worktree, the Skill verifies tests pass, offers four options (merge locally, create PR, keep, discard), executes the chosen workflow, and cleans up the worktree only when appropriate. ## Quick Start Ask the assistant to finish the current development branch and choose whether to merge it, open a pull request, keep it, or discard it.

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

First verify the test suite passes, then check out the base branch, pull latest changes, and merge the feature branch. Re-run tests on the merged result before deleting the branch with git branch -d to confirm nothing broke.

How do I create a pull request from a feature branch?▼

Push the branch with git push -u origin <branch>, then run gh pr create with a title and body containing a summary and test plan. Keep the worktree alive afterward so you can iterate on PR feedback.

Why does git branch -d fail when a worktree uses the branch?▼

Git refuses to delete a branch that is checked out in a worktree. Remove the worktree first with git worktree remove from the main repository root, then delete the branch.

Can I remove a git worktree from inside the worktree itself?▼

No, running git worktree remove while your working directory is inside that worktree silently fails. Change directory to the main repository root first, then run git worktree remove followed by git worktree prune.

What happens to unmerged work when discarding a branch?▼

Discarding permanently deletes the branch, its commits, and the worktree. The Skill requires typing 'discard' as explicit confirmation before running git branch -D, preventing accidental loss of work.