Cheat Sheets · Git Cheat Sheet · Git Resolve Merge Conflict — Complete Workflow

Git Resolve Merge Conflict — Complete Workflow

1. Check status

git status

2. Edit files

Manual / IDE

3. Stage resolved

git add

4. Complete merge

git commit

Abort if needed

git merge --abort

Conflict resolution workflow

StepCommandDescription
1. Check statusgit statusIdentify all files marked "both modified"
2. Edit filesManual / IDEOpen files, choose content, remove <<<<<<<, =======, >>>>>>> markers
3. Stage resolvedgit add <file>Mark conflict as resolved in Git index
4. Complete mergegit commitFinalize merge commit with default message
Abort if neededgit merge --abortCancel merge and revert to pre-merge state

Merge conflicts occur when two branches modify the same lines of a file. Git pauses and inserts conflict markers so you can decide which version to keep.

Related Git recipes

FAQ

What does <<<<<<< HEAD mean?
HEAD marks the code currently on your active branch. The code after ======= and before >>>>>>> comes from the branch you are merging in.

How do I abort a conflict during a rebase?
Run git rebase --abort.

Can I choose one branch's version entirely?
Yes: git checkout --ours keeps current branch, git checkout --theirs accepts incoming branch.

Stop memorizing — build it interactively

Try conflict resolution in the Git Builder

Full reference: Git Cheat Sheet