Resolving Git conflicts with Javascript
It is difficult to tell &quot;which one is better&quot;. As Jan mentioned in a comment:

&quot;tell which one is better&quot; - what does &quot;better&quot; mean? performance? code readability? ... ?

The notion of better is subjective.
I am drawn to the first solution as it uses the fewest lines, though readability suffers because the lines are quite long and there are nested ternary operators.
I notice Solution 2 uses ES6 features like arrow functions (as all solutions do) yet it uses the var keyword. Some believe there is no use for var in modern JS. The variable newLines could be declared with const if instead of re-assigning it in the else if block the length property was set to 0 to truncate it and the mapped values were spread into a call to the push method. Using const instead of let helps avoid accidental re-assignment and other bugs.