Skip to content

Finishing a Development Branch

协作类

Use when implementation is complete and all tests pass, need to decide how to integrate the work.

Quick Start

Understand in 30 Seconds

Guide development work to completion: verify tests → present options → execute choice → cleanup.

When to Use

  • Implementation complete
  • All tests pass
  • Need to decide how to integrate work

Complete Guide

Core Process

Step 1: Verify Tests

Before presenting options, verify tests pass:

bash
npm test / cargo test / pytest / go test ./...

Step 2: Determine Base Branch

bash
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null

Step 3: Present Options

Implementation complete. What would you like to do?

1. Merge locally back to <base-branch>
2. Push and create Pull Request
3. Keep branch as-is (I'll handle it later)
4. Discard this work

Step 4: Execute Choice

Option 1: Local Merge

bash
git checkout <base-branch>
git pull
git merge <feature-branch>
git branch -d <feature-branch>

Option 2: Push and Create PR

bash
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "..."

Step 5: Cleanup Worktree