finishing-a-development-branch

Guides completion of development branches through structured merge, pull request, or cleanup options.

Updated Jul 23, 2025
One-click install
npx skills add https://github.com/derrik-fleming/dotfiles --skill finishing-a-development-branch-derrik-fleming
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/derrik-fleming/dotfiles/tree/main/private_dot_agents/skills/finishing-a-development-branch
Command: npx skills add https://github.com/derrik-fleming/dotfiles --skill finishing-a-development-branch-derrik-fleming

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers often face an ambiguous decision point: merge locally, open a pull request, keep the branch, or discard it. This Skill removes that ambiguity by verifying tests first, detecting the git environment, and presenting a fixed set of structured options with safe execution and cleanup. ## Core Features & Use Cases - Test-gated completion: Runs the project's test suite before offering any integration option and stops if tests fail. - 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, changes to the main repo root before removal, and requires typed confirmation before discarding work. - Use Case: After finishing a feature in a git worktree, the Skill verifies tests pass, asks whether to merge to main or open a PR via gh pr create, then cleans up the worktree and deletes the branch only after a successful merge. ## Quick Start Ask the assistant to finish the current development branch and choose whether to merge it locally, 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 feature branch back into main?▼

Verify the test suite passes first, 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.

How do I create a GitHub pull request from the command line?▼

Push the branch with git push -u origin, 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 review 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, git worktree remove fails silently when the working directory is inside the worktree being removed. Change to the main repository root first, then run the removal followed by git worktree prune.

What happens differently on a detached HEAD when finishing work?▼

A detached HEAD indicates an externally managed workspace, so local merging is not offered. The options reduce to pushing as a new branch with a pull request, keeping the state as-is, or discarding the work.