Reputation: 3318
I would like to know if it's possible with one or more Linux command to remove the markers
<<<<<<< HEAD
...
=======
...
>>>>>>> master
from a GIT conflict automatically.
This is the the only way to keep BOTH changes, I suppose. And no, the order doesn't really matter for what I'm trying to do.
Is this possible?
Upvotes: 1
Views: 905
Reputation: 522581
Here is quick solution using grep
:
grep -vwE "(<<<<<<< HEAD|=======|>>>>>>> master)" input > output
I assume that the file containing the source code with Git markers is called input
and the above command will generate the file output
with all the markers removed. Note that Git wisely chose very bizarre looking markers for merge conflicts which are highly unlikely (I have never seen it) to appear in normal source code anywhere. That being said, you should make sure that the markers won't match anything else.
Upvotes: 2