Intermediate · 6 min read
Resolve conflicts like a pro
Read the markers, choose, test, and avoid the same conflict twice.
Read the markers
<<<<<<< HEAD is your side, ======= separates, >>>>>>> is the incoming side. With diff3 style you also see the original version in between, which makes choosing much easier.
Safe
$ git config --global merge.conflictStyle zdiff3
Use a tool
VS Code and JetBrains have a 3-way merge editor. Or launch the configured merge tool.
Safe
$ git mergetool
Finish properly
No marker left (search for <<<<<<<), the project builds, the tests pass. Then add and continue.
Safe
$ git grep -n "<<<<<<<"$ git add .$ git commit
Never twice
rerere records your resolutions and reapplies them automatically during long rebases.
Safe
$ git config --global rerere.enabled true