Application Kata "Conflict resolver"

Write a tool to resolve conflicts in text files.

Conflicts are marked by Git, for example, when merging commits from different branches (see e.g. GitHub Documentation for resolving conflicts):

the solar system
the number of planets is
<<<<<<>>>>>> branch-a
earth is the 3rd planet

A "source of conflict" is introduced with <<<<<<>>>>>>. The conflicting passages are separated between these brackets by =======. "HEAD" or "branch-a" designate the sources of the text alternatives in a Git repository.

The tool should display a text file with such conflict passages and make it easy to select the text alternatives. For this purpose, the competing passages can be displayed in parallel, e.g. like this:[1]

Application Kata Konfliktlöser - Clean Code Developer Akademie

Text that is the same in both alternatives appears on both sides. Text that differs is highlighted in color - with the same color on both sides. This makes it clear which passages are opposite each other.

When scrolling in the text, the conflicting texts should remain together; both pages should therefore be scrolled synchronously.

The presentation should clearly indicate which conflict is the focus.

It must be easy to choose one or the other or both or even none of the alternatives. It should also be possible not to decide and to leave the conflict as it is.

After the selection has been made, it should be clearly displayed how the choice was made.

Of course, the decision can be changed again for each conflict until it is saved.

Endnotes

[1] Please note: It must also be possible to compare a missing text in one alternative with an existing text in the other!

en_USEnglish