Docs
HomeClaude Code PRO
Blog

Getting Started

  • Documentation
  • Claude Code Setup
  • Claude Code Configuration
  • Claude Code Security

Claude Code PRO

  • guideCheatsheet
  • skill/apex
  • skill/brainstorm
  • skill/debug
  • skill/clean-code
  • skill/review-code
  • skill/ci-fixer
  • skill/claude-memory
  • skill/create-prompt
  • skill/create-slash-commands
  • skill/prompt-creator
  • skill/create-skills-workflow
  • skill/skill-creator
  • skill/hook-creator
  • skill/subagent-creator
  • scriptStatusline
  • scriptCommand Validator
  • scriptAuto-Rename Session
  • scriptClaude Code AI
  • agentSnipper
  • agentCode Reviewer
  • agentExplore Codebase
  • agentExplore Docs
  • agentAction
  • agentWeb Search
  • cmd/oneshot
  • cmd/refactor
  • cmd/ultrathink
  • cmd/commit
  • cmd/create-pr
  • cmd/fix-pr-comments
  • cmd/merge
  • cmd/fix-errors
  • cmd/utils/fix-grammar
  • cmd/copywriting

/merge

Intelligently merge branches with context-aware conflict resolution

Usage

BASH
/merge <branch-name>

Overview

Smart branch merging that gathers context from PRs and issues before resolving conflicts. Prevents resolution loops with intelligent conflict handling.

Workflow

  1. Context Gathering: Check current branch and working tree status
  2. Feature Analysis: Research PR/issue context using gh cli
  3. Merge Attempt: Fetch and merge with --no-commit
  4. Conflict Detection: Parse conflicted files
  5. Smart Resolution: Apply context-aware resolution strategies
  6. Verification: Review changes and check for remaining markers
  7. Failure Handling: Abort after 3 attempts per file

Conflict Resolution Strategies

By File Type

  • package.json: Merge dependencies, prefer higher versions
  • Config files: Combine settings unless mutually exclusive
  • Source code: Use PR/issue context to understand intent
  • Tests: Keep all tests unless duplicates

By Pattern

  • Import conflicts: Merge all imports, deduplicate
  • Function additions: Keep both if different purposes
  • Modified same line: Use context to determine correct version
  • Deleted vs modified: Check if deletion was intentional

Safety Rules

  • ABORT if uncommitted changes exist
  • STOP if >10 files conflicted (ask user for guidance)
  • NEVER blindly accept theirs/ours without analysis
  • Max 3 resolution attempts per file
  • Always gather context before merging

Example

BASH
# Merge feature branch into current branch
/merge feature/new-login

# Claude will:
# - Check current branch status
# - Fetch PR/issue context
# - Merge with conflict detection
# - Resolve conflicts intelligently
# - Commit with descriptive message

Allowed Tools

  • git and gh commands
  • Read, Edit, MultiEdit
  • Task (for parallel context gathering)
/fix-pr-comments/fix-errors