Assume the following situation:
- Create a file with contents
Hello World!
, add it, commit. - Change it to
Hi World!
in one branch, and toHello World
in another branch. - Now merging them will result in a conflict, because both changes are on the same line.
Consider the alternative where we separate the changes on different lines:
1. Create a file with contents Hello\nWorld\n!
. (I'm denoting a line break by \n
.)
2. Apply the analogous changes as before.
3. Now suddenly merging will work.
But a line break is a character like any other. Why does merging treat it so special?
More importantly, are there git-compatible merge tools that will merge my first example without conflicts, i.e. is it possible to merge changes within a line?