How to Resolve Git Merge Conflicts?

Got CONFLICT during merge or rebase, not sure how to handle it

Solutions

Recommended

# 1. git status # 2., # <<<<<<< HEAD
# # =======
# # >>>>>>> branch-name # 3. git add <>
git commit # merge # git rebase --continue # rebase

, <<<< ==== >>>>, (),.

:

git mergetool

(VS Code, Beyond Compare and more).

:,

git merge --abort
# git rebase --abort

/rebase,.

:,

# git checkout --ours <file>
# git checkout --theirs <file>
git add <file>

,.

:

--ours --theirs,

Related Commands