Git Conflict Simulator

Simulate merge conflicts, resolve interactively, and learn conflict resolution commands

1 Edit branches
2 Merge & view conflict
3 Resolve
4 Result
Branch Editor
Conflict View
Commands Reference
Branch: main ours
Branch: feature/login theirs
Basic Merge & Abort

Start a merge and how to abort it if things go wrong.

# Merge a branch into current branch
git merge feature/login

# Abort the merge (restore to pre-merge state)
git merge --abort

# Check merge status
git status
Viewing Conflicts

Identify which files and lines are in conflict.

# List conflicting files
git diff --name-only --diff-filter=U

# Show conflict markers in detail
git diff

# Show concise conflict summary
git diff --check

# View merge status with short format
git status --short
Resolving with git checkout

Accept one side entirely for specific files.

# Accept our version of the file
git checkout --ours -- path/to/file.js

# Accept their version of the file
git checkout --theirs -- path/to/file.js

# Stage the resolved file
git add path/to/file.js
Resolving with git restore

Modern alternative using git restore (Git 2.25+).

# Restore file to our branch version
git restore --staged --worktree --ours -- path/to/file.js

# Restore file to their branch version
git restore --staged --worktree --theirs -- path/to/file.js

# Stage after resolution
git add path/to/file.js
Merge Strategies

Apply strategies per-file during merge.

# Resolve: leave conflict markers for manual resolution
git merge -s resolve feature/login

# Recursive with specific options
git merge -X ours feature/login    # auto-resolve conflicts favoring ours
git merge -X theirs feature/login  # auto-resolve conflicts favoring theirs

# Ignore whitespace changes during merge
git merge -X ignore-all-space feature/login
Manual Resolution Workflow

The full manual workflow: edit, mark resolved, commit.

# 1. Open conflicting file in editor and resolve markers
vim path/to/file.js

# 2. Mark file as resolved
git add path/to/file.js

# 3. If all conflicts resolved, complete merge
git commit

# Or use the convenience flag (Git 2.36+)
git commit --continue

# Verify no remaining conflicts
git diff --name-only --diff-filter=U
Rebase Conflicts

Conflicts also occur during rebase operations.

# Rebase onto main
git rebase main

# After resolving each conflict
git add <resolved-file>
git rebase --continue

# Skip this commit if it's empty after resolution
git rebase --skip

# Abort the rebase entirely
git rebase --abort
Cherry-Pick Conflicts

Applying specific commits can also produce conflicts.

# Cherry-pick a commit
git cherry-pick abc123

# After resolving
git add <resolved-file>
git cherry-pick --continue

# Abort cherry-pick
git cherry-pick --abort
Using mergetool

Launch a visual merge tool for interactive resolution.

# Launch configured merge tool
git mergetool

# List available merge tools
git mergetool --tool-help

# Use a specific tool
git mergetool --tool=vimdiff
git mergetool --tool=vscode
git mergetool --tool=nvimdiff
Rerere (Reuse Recorded Resolution)

Let Git remember how you resolved a conflict and auto-apply it next time.

# Enable rerere for the repo
git config rerere.enabled true

# Enable globally
git config --global rerere.enabled true

# Check recorded resolutions
git rerere status

# Show what rerere would do (dry run)
git rerere diff