← ClaudeAtlas

resolve-conflictslisted

Analyze and resolve Git merge/rebase conflicts intelligently, showing diffs and asking clarifying questions when needed. Invoke with /resolve-conflicts.
mthines/agent-skills · ★ 4 · Code & Development · score 83
Install: claude install-skill mthines/agent-skills
# Resolve Git Conflicts You are tasked with helping resolve Git merge or rebase conflicts. This command handles both active conflict states and proactive conflict preview/resolution. ## Step 1: Detect Conflict State First, determine the current state: ```bash # Check if we're in the middle of a merge git rev-parse --verify MERGE_HEAD 2>/dev/null && echo "MERGE_IN_PROGRESS" || echo "NO_MERGE" # Check if we're in the middle of a rebase test -d "$(git rev-parse --git-dir)/rebase-merge" -o -d "$(git rev-parse --git-dir)/rebase-apply" && echo "REBASE_IN_PROGRESS" || echo "NO_REBASE" # Check for unmerged files (active conflicts) git diff --name-only --diff-filter=U ``` Based on results: - **Active merge conflict**: MERGE_HEAD exists + unmerged files present - **Active rebase conflict**: rebase-merge/rebase-apply dir exists + unmerged files present - **No active conflict**: Can preview differences for potential conflicts ## Step 2: Gather Context ### Get Branch Information ```bash # Current branch git branch --show-current # Target branch (default: main) git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main" # Fetch latest to ensure accurate comparison git fetch origin ``` ### If Active Conflict Exists ```bash # List all conflicted files git diff --name-only --diff-filter=U # Show the conflict markers in each file git diff --check ``` ### If No Active Conflict (Preview Mode) ```bash # Show what would change when mergin