3

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
Ahmad
  • 69,608
  • 17
  • 111
  • 137
ant2009
  • 27,094
  • 154
  • 411
  • 609
  • 1
    Your question isn't really how to automatically remove the markers - that's a scary thought, since there's no guarantee that what's left will make any sense. You're asking how to keep a particular version in a merge. – Cascabel Nov 02 '10 at 14:40

3 Answers3

5

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

Community
  • 1
  • 1
brycemcd
  • 4,343
  • 3
  • 26
  • 29
3

Take a look this: keep either file in merge conflicts

Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
2

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:

Community
  • 1
  • 1
takeshin
  • 49,108
  • 32
  • 120
  • 164