Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

How do I resolve a git merge conflict in favor of pulled changes?

Basically, I need to remove all conflicting changes from a working tree without having to go through all of the conflicts with a git mergetool while keeping all conflict-free changes. Preferably doing this while pulling, not afterward.

1 Answer

0 votes
by (27.5k points)

Case 1: In case you are in a conflicted state and you want to just accept all of theirs:

$ git checkout --theirs .

$ git add .

Case 2: In case you want to do the opposite:

$ git checkout --ours .

$ git add .

Remember this method is pretty drastic, so make sure you really want to wipe everything out like this before doing it.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers


108k users

Browse Categories