Running Merge Conflict

JavaScript (ES6), 102 94 93 90 bytes

console.log('Hello',(a=`
<<<<<<<
Mine
=======
Theirs
>>>>>>>
Conflict`.split`
`)[6]||a[1])

If the conflict has been resolved, then there is no sixth line, so it prints the now first line instead. Edit: Saved 3 bytes thanks to @nderscore.


Brachylog, 68 67 66 bytes

"Hello "wċ₂↰₁w∨"Conflict"w
<<<<<<<
"Mine"
=======
"Theirs"
>>>>>>>

Try it online!

Try the "Hello Mine" version here

Try the "Hello Theirs" version here

Explanation

Thankfully, <<<<<<<, ======= and >>>>>>> are all valid rule definitions in Brachylog. They respectively mean:

  • Input is less than an implicit varible, itself less than..., etc., itself less than the output.
  • All elements of the input are equal, and all elements of the input are equal, and..., and Input = Output
  • Same as the first but greater than instead.

If we remove conflicts, we end up with "Mine" or "Theirs" on the second line, which means they become predicate number 1. Calling that predicate with ↰₁ on the first line will unify its input and output with Mine / Theirs, which we then print with w.

If we call ↰₁ on the conflicted file, we end up calling <<<<<<<. We therefore call that predicate with a string as input (using ċ₂ - coerce to string). < will fail with a string as input. We then put a disjunction ∨"Conflict"w in the main predicate which states that if predicate 1 fails, then we print Conflict instead. ↰₁ with a string as input won't fail for the "Mine" or "Theirs" lines because they are strings.


PHP, 74 65 bytes

Note: uses IBM-850 encoding

Hello<?='
<<<<<<<
2:<?PU_~
=======
+;73"&_~
>>>>>>>
'^~ıǼ¡Ñ»¬áü;

Store to a file and run like this:

php -nf conflict.php

Explanation

Hello       # Print "Hello"
<?='        # Print result of expression
<<<<<<<     # String with merge conflict
2:<?PU_~
=======
+;73"&_~
>>>>>>>
'
^           # XOR that string with...
~ıǼ¡Ñ»¬áü; # ... this string, negated.

The binary XOR results in either of the following 3:

'
<<<<<<<
' ^ ~'ıǼ¡Ñ»¬áü'
==> ' Conflict' 
--------------------------------------------------------------------------
'
2:<?PU_~' ^ ~'ıǼ¡Ñ»¬áü'
==> ' Mine' (right padded with nul bytes)
--------------------------------------------------------------------------
'
+;73"&_~' ^ ~'ıǼ¡Ñ»¬áü'
==> ' Theirs' (right padded with nul bytes)

Tweaks

  • Saved 9 bytes by using binary logic on strings