Answer the question
In order to leave comments, you need to log in
How to resolve the conflict from the command line?
Essence:
git checkout branch_a
git merge branch_b
<<<<<<< HEAD
text1
=======
text2
>>>>>>> branch_b
Answer the question
In order to leave comments, you need to log in
#отменить неудачное слияние
git merge --abort
# повторить слияние используя опцию theirs
git merge -Xtheirs branch_b
# при конфликтах выберется вариант из вливаемой ветки
By default, when Git notices a conflict when merging branches, it adds conflict markers to the code, marks the file as conflicting, and lets you resolve it. If, instead of manually resolving the conflict, you want Git to simply use one particular version of the file and ignore the other, you can pass one of two options to the merge command,-Xours
or-Xtheirs
.
In this case, Git will not add conflict markers. It will merge all non-conflicting changes, and for conflicting changes, it will take the entire version that you specified (this also applies to binary files).
too lazy to fiddle with corners
git checkout branch_b -- имя_файла # оставить версию файла из ветки branch_b
git add имя_файла # сбросить состояние конфликта
# ... разрешить другие конфликты
git merge --continue --no-edit # создать коммит слияния
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question