Resolve Conflicts in Git

From the Git cheat sheet · Merge Conflicts · verified Jul 2026

Resolve Conflicts

Handle and fix merge conflicts when combining branches

bash
# During merge conflict
git status              # See conflicted files

# Resolve conflicts manually, then:
git add <resolved-file>
git commit             # Complete merge

# Abort merge
git merge --abort

# Use specific version
git checkout --ours <file>    # Keep current branch
git checkout --theirs <file>  # Take other branch
💡 Conflicts show both versions in the file
✅ Always test after resolving conflicts
🔧 Use a merge tool for complex conflicts
⚡ --ours/--theirs for quick resolution
Back to the full Git cheat sheet