Compare Code Changes With Diffuse

Diffuse Graphical Compare And Merge

Live stream set for 2025-05-07 at 14:00:00 Eastern

Ask questions in the live chat about any programming or lifestyle topic.

This livestream will be on YouTube or you can watch below.

The Graphical Diff And Merge Tool For Developers

Diffuse compares files and retrieves version controlled project files.

Diffuse can perform three-way comparison if desired. Merge branches, resolve conflicts visually side-by-side for popular version control systems such as Git. Diffuse is free, open source and cross-platform (Mac, Windows and Linux) and integrates seamlessly with popular IDEs.

Identical files will not produce an output. It is not wise for Binary files to be opened directly.

The focus of this tutorial will be on the differences between 2 text files, 2 binary files and 3 folders.

  1. Creating 2 files.
  2. Running the Diffuse command on the 2 files.
  3. Running the Diffuse tool on the 3 files.
  4. Explaining the output diff or patch.

Requirements For Using Diffuse

Glossary:

IDE

Integrated Development Environment is a software application used for software development.

Patch

Set of differences.

Diff

Tool used to compare files or sets of files and highlight their differences.

Merge

Combines changes from different versions or branches of a project into a single, unified version.

Binary File

Computer file that is not a text file.

Tools

Programming Tools
Name Description Example
Bitmap editor For creating and editing bitmap images GNU Image Manipulation Program (GIMP)
Text editor For creating and editing source code Apache Netbeans IDE
SSH Secure Shell Client OpenSSH
Shell Access Access to the command line. Terminal
Diffuse File comparison utility. Diffuse
Name Description Example

Create First Text File

# Create New Text File #
cat > test1.txt << 'EOF'
Check out the awesome feature
On Ojambo.com
For making a donation
In the header bar
EOF

Create Second Text File

# Clone New Text File #
cp test1.txt test2.txt

Create Third Text File

# Create New Text File #
cat > test3.txt << 'EOF'
Check out the awesome feature
On OjamboShop.com
For taking a course
In the header bar
EOF

Compare Any Two Files

# Compare Files With Diffuse #
diffuse test1.txt test2.txt
diffuse test1.txt test3.txt
diffuse test1.jpg test2.jpg
diffuse test1.jpg test3.jpg

Compare Any Three Files

# Compare Files With Diffuse #
diffuse test1.txt test2.txt test3.txt
diffuse test1.jpg test2.jpg test3.jpg
diffuse test1.txt test2.txt test1.jpg

Explanation:

  1. The first and second files are the same.
  2. The first and third files are different.
  3. Binary files out only state if they “differ”.

The Diffuse tool will compare 2 or 3 files. Access the N-way File Merge menu in Diffuse.

Diffuse Visually Compare 2 Binary Images
Diffuse Visual Comparison Of 2 Binary Images Displaying Problems

Diffuse Visually Compare 2 Text Files
Diffuse Visual Comparison Of 2 Text Files Displaying Differences

Diffuse Visually Compare 3 Text Files
Diffuse Visual Comparison Of 3 Text Files Displaying Differences

Diffuse Visually Start N-Way File Merge
Diffuse Visual Start N-Way File Merge From File Menu

Diffuse Visually Compare Same File In Git Project Folder
Diffuse Visual Comparison Of The Same File In Git Project Folder Displaying Differences


Usage

You can start Diffuse on the command-line, file manager or from the application start menu. For this tutorial, Diffuse was used on text files and binary files. Diffuse can be downloaded from Diffuse.

Open Source

Diffuse is licensed under the GNU General Public License Version 2.0 or later. The copyleft license comes with strict rules and requirements to ensure the software remains free and open-source. It allows commercial use, modification, distribution, and allows making derivatives proprietary, consult the license for more specific details.

Conclusion:

Diffuse is a powerful graphical diff and merge tool. Developers can use the tool streamline code reviews and resolve conflicts. Diffuse can compliment source code management version control systems such as Git in merging branches.

The programmer can determine which changes to revert based on the line number output. Use Diffuse to annotate code, provide clear feedback, and track changes during code reviews.

If you enjoy this article, consider supporting me by purchasing one of my WordPress Ojambo.com Plugins or programming OjamboShop.com Online Courses or publications at Edward Ojambo Programming Books or become a donor here Ojambo.com Donate

References:

Leave a Reply

Your email address will not be published. Required fields are marked *