
Finishing A Development Branch
You've finished implementing a feature and all tests pass. Now what? This skill gives you four clear options: merge locally, push and create a PR, keep the branch for later, or discard the work entirely. The smart part is it runs your test suite first and won't let you proceed if anything fails, then cleans up git worktrees automatically for the merge and discard paths while preserving them when you might still need them. It also forces you to type "discard" before nuking any work, which has probably saved someone from a bad day. Works as the final step in subagent-driven-development and executing-plans workflows, handling that awkward moment when the code works but you haven't decided what to do with it yet.
- GitHub stars
- 492
- last updated
- Jun 11, 2026
Install
$ npx -y skills add ganyuanran/aegis --skill finishing-a-development-branch --agent claude-codeInstalls into .claude/skills of the current project.
Files
Finishing a Development Branch
Overview
Integration choice and checkout lifetime are separate. Verify first, mutate only task-owned resources, then prove what was removed or retained.
Core principle: fresh evidence -> authorized integration -> ownership-aware cleanup -> Git/path readback.
Announce at start: explain which branch/worktree lifecycle is being closed.
Step 1: Environment and Ownership Detection
Read the task's TaskStartSnapshot and current repository state. Record:
- root,
HEAD, branch/detached state, upstream divergence, and active Git ops; - staged/unstaged/untracked paths and the task-owned delta;
git worktree list --porcelain;- branch/worktree creator, task ownership, base branch, and cleanup trigger.
Stop on conflicts, unexplained detached state, failed verification, dirty/untracked state in
a cleanup target, or unknown ownership. Do not infer the base from the names
main or master; use task records, repository authority, or explicit user
direction. Never auto-stash, reset, clean, pull, rebase, amend, force-push, or
bypass hooks.
Sponsors
Details
- Repository
- github.com/ganyuanran/aegis
- Category
- Git & Pull Requests
- License
- MIT
- First seen
- Jun 11, 2026
More from ganyuanran/aegis
All 22- First Principles Review
- Goal Framing
- Long Task Continuation
- Receiving Code Review
- Recording Architecture Decisions
- Requesting Code Review
- Subagent Driven Development
- Systematic Debugging
- Test Driven Development
- Update Aegis
- Using Aegis
- Using Git Worktrees
- Verification Before Completion
- Writing Plans
- Writing Skills
- Anti Entropy Governance
- Brainstorming
- Communicating Concisely
- Dispatching Parallel Agents
- Establishing Project Context
- Executing Plans