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
  • 64,492
  • 17
  • 108
  • 135
ant2009
  • 29,065
  • 146
  • 383
  • 576
  • 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,153
  • 3
  • 23
  • 29
3

Take a look this: keep either file in merge conflicts

Paul Dixon
  • 287,944
  • 49
  • 307
  • 343
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
  • 46,872
  • 32
  • 117
  • 162