ant2009
ant2009

Reputation: 22636

automatically removing conflict markers

What is a quick way to remove conflict markers from source code?

I have just merged some changes, and now I have a lot of files in conflict.

I started to manually remove them. However, this would take too much of my time.

Is there a way git can automate this?

I just want to keep all HEAD's and discard all the rest.

<<<<<<< HEAD
.
.
.
.
=======
.
.
.
.
>>>>>>> ffa5c899d36e779c23cff8b33f48f2ab95ef08c8

Upvotes: 3

Views: 3454

Answers (3)

brycemcd
brycemcd

Reputation: 4523

This post will be useful to you: How to use my changes for merge in git?

I think what you want is: git merge otherbranch -s recursive -X ours

Upvotes: 5

takeshin
takeshin

Reputation: 50688

It looks like you are trying to resolve the conflicts by hand, instead of git mergetool.

There are many merge tools described on StackOverflow, like:

Resolving conflicts is a pretty wide topic.

Some common practices:

  • checkout local version (restore changes)

    git reset -- filename

  • checkout remote version (override changes)

    git checkout ORIG_HEAD -- filename

See also:

Upvotes: 2

Paul Dixon
Paul Dixon

Reputation: 301065

Take a look this: keep either file in merge conflicts

Upvotes: 3

Related Questions