Diffuse

Why Ditana suggests Diffuse as diff/merge tool.

Diffuse is unfortunately not as widely used as tools like Meld, KDiff3 and P4Merge. While these alternatives offer slightly different functionalities in their diff capabilities, Diffuse excels in its merge functionality.

Diffuse supports n-way merges and displays all versions involved in the merge process. In contrast, Meld does not display the base version, which can be crucial for resolving complex merge conflicts. Additionally, Diffuse allows for manual alignment of lines, which is important when code blocks have been moved and simultaneously modified. The merge view in Diffuse may require some getting used to, as it presents four side-by-side windows:

  • A: The local version
  • B: The merged version (the one you work on)
  • C: The remote version
  • D: The base version

For comparison, KDiff3 (which also allows manual alignment) displays four windows as well. However, the result window B is positioned below the “supplier” versions of the files, similar to Meld and P4Merge. Meld does not show the base version, and in P4Merge, the controls for resolving merge conflicts can be somewhat unintuitive. Neither Meld nor P4Merge allow for manual alignment of lines.

To resolve a merge conflict in Diffuse, navigate between differences using Ctrl+Down and Ctrl+Up. In the resulting file B, you will see the text that Git itself generates in the event of a conflict (unlike other tools). For example:

<<<<<<< HEAD
`kora-yellow-icon-theme` is used by ditana-config-xfce on Ditana GNU/Linux.
=======
`kora-yellow-icon-theme` is used by [ditana-config-xfce](https://github.com/acrion/ditana-config-xfce) on Ditana Linux.
>>>>>>> 8a5933f8aba535f7265111ec806f91d6107f3ab6

In this example, a merge conflict occurs because this line was modified in two places: both in the local version A (which added “GNU/”) and in the remote version C (which added a link).

In such cases, the approach is similar to other merge tools: choose either A or C to resolve the merge conflict and manually incorporate changes from the other version in the merge editor. To do this:

  1. Select the conflicting lines using Ctrl+Down or Ctrl+Up.
  2. Choose “Copy Right Into Selection” (Ctrl+Left) if you want to adopt C (the remote version), which is the quicker option in the example above, or choose “Copy Left Into Selection” (Ctrl+Right) if you prefer to adopt A (the local version).
  3. Double-click the area in B that you wish to edit, make the necessary changes, and then press the Escape key.
  4. Close Diffuse, which will prompt you to save your changes.

Afterwards, confirm the successful merge in Git with git commit (Git message: use "git commit" to conclude merge).

Why Ditana Chooses Diffuse

While there are several merge tools available, Ditana has chosen to include Diffuse due to its superior merge capabilities, particularly its support for n-way merges and comprehensive version display. These features make Diffuse especially effective for handling complex merge conflicts that other tools may struggle with. Additionally, Diffuse’s ability to align lines manually ensures that developers can manage intricate code changes with greater precision. Although Diffuse’s merge interface may take some time to get accustomed to, its robust functionality provides significant advantages for development workflows in Ditana.