In the world of software development, the ability to merge code from different versions or branches is indispensable. This need often leads developers to the doors of various file-differencing programs. While many developers are familiar with utilities like Windiff.exe or TortoiseMerge, provided by the Microsoft Visual Studio .NET environment, there are other tools worth considering that offer enhanced capabilities.
Windiff.exe and TortoiseMerge: These tools, familiar to those working within the Visual Studio ecosystem, provide basic functionality for comparing files and identifying differences. They serve as a solid starting point for developers new to code merging and file comparison.
Araxis Merge: This utility stands out by offering more advanced features compared to Windiff.exe and other similar tools. Araxis Merge excels in identifying the exact characters within a line that have changed, enhancing the precision of code comparison. Furthermore, it allows for direct file editing within the utility and supports folder-based differencing. This can be incredibly convenient, as developers can compare entire directories with a simple right-click in Windows Explorer, choosing “Compare with Araxis Merge” for the desired files or folders.
Open Source Alternatives: For those who prefer open-source solutions, WinMerge is a notable mention. Available from the SourceForge community, WinMerge offers a robust set of features for file and folder comparison, appealing to developers looking for a cost-effective solution.
For Mac Users: Mac OS users have options like Guiffy, a tool that caters specifically to their operating system. While not as widely used as some Windows-based tools, Guiffy offers reliable functionality for file comparison and merging on Mac platforms.
Choosing the Right Tool: Determining the "best" merge and diff tool ultimately depends on your specific needs, platform, and workflow preferences. While I have a long-standing preference for Araxis Merge due to its advanced features and user-friendly interface, others may find open-source tools like WinMerge or platform-specific utilities like Guiffy to be better suited to their needs.
In upcoming reviews, I'll dive deeper into the features, pros, and cons of these tools, providing you with the information needed to make an informed decision on the best diff/merge utility for your development work. Stay tuned for detailed comparisons and insights that will help streamline your code merging process.
TortoiseMerge
At least for files which consist of text, TortoiseMerge can help you here. It shows you the two versions of a file side-by-side, coloring every modified line in that file. You can see in that screenshot that TortoiseMerge also illuminates the changes inside modified lines so you can see immediately what exactly has changed.
When you reformat your code or text, sometimes you don't really change anything but only split a long line into multiple ones, or you merge multiple lines into one. TortoiseMerge marks such changes with a white circle on the left gray bar of each view. If you see such a white circle, you know that no real changes were made, only changes in whitespaces.
At the bottom of the window, there is a view showing the two lines your mouse pointer is currently hovering over. It always shows whitespace characters with special chars, and of course it's very handy if you have long lines because that view has the double width than the normal views.
Resolving conflicts
But that's not all TortoiseMerge is able to do for you. It can also help you resolve a conflict by showing you your file, the file which has been modified by someone else and the file as it was before any of you have changed it, in its original state. Then you can easily see where the changes made conflict, and you can choose how to resolve that conflict.
Araxis Merge
Araxis Merge will then display a side-by-side view of the two folder structures, showing not only which files have changed between the two folder structures, but also the number of differences found in each file and optionally other information, such as the date and time stamps on the files. Once you have the comparison window open showing the differences between data in the two folder structures, you can easily elect to view the actual differences of a particular file. Araxis Merge version is available in two versions, standard and professional.
1. Folder comparison button on quick access toolbar
Click this button to launch a folder comparison window. Folder comparison windows let you compare and synchronize entire folder hierarchies. Other buttons on this quick access toolbar enable text, binary and image comparisons to be launched with a single click.
2. Report button
Click this button to create a report of the file comparison in HTML, HTML slideshow, XML or UNIX diff format. HTML reports are particularly useful for archiving and distribution.
3. Automatic merge to common ancestor button (Professional Edition only)
Click this button to merge automatically non-conflicting changes from the left and right files into the centre common ancestor file of a three-way comparison.
4. Three-way comparison button (Professional Edition only)
Click this button to change to a three-way file comparison view.
5. Tab strip
The tab strip lets you switch quickly between different file comparisons if you have several open at once.
6. Read-only and file modified indicators
The left icon Indicates that a file is read-only. Read-only files may only be edited if you have configured Merge to allow this.
The right icon indicates that the file has been edited or modified since the comparison was first performed. Note that editing is disabled by default in read-only files, but can be enabled if desired.
7. Move the linking lines panel
Drag the linking lines panel left or right from here to change the relative widths of the file comparison panes. Double click to re-centre.
8. Removed block of text
This block of text is present only in the left-hand file. The connecting lines show you exactly where the text would have to be inserted in the right file to make the two files identical.
9. Merging button
Click a merging button to copy a block of text to the other file, replacing any corresponding block. Hold down Ctrl while clicking to insert instead of replacing. Hold Ctrl+Shift and click to delete a block of text.
10. Vertical scrollbar
As you scroll one file, the other is automatically scrolled to keep matching parts of the two files visible. Hold down Ctrl while scrolling to prevent this and only scroll one file.
11. Bookmark
You can set bookmarks in a file to help keep track of important locations as you are editing. Comments can be added to bookmarks, and are included when you save a comparison (perhaps for archiving or sharing with colleagues) and also in HTML comparison reports.
12. Omitted lines indicator
By default, Merge shows all unchanged lines of text. However, it is possible to omit some of the unchanged text to avoid showing irrelevant information.
13. In-place editing
You can edit either file directly in-place. The file comparison automatically updates as you make changes.
14. Overview strip
This gives you an immediate idea of the extent of the differences between the files being compared. Each colour-coded mark on the strip represents a difference. You can click on the overview strip to jump directly to particular change.
15. Centre point marker
Merge tries to keep matching parts of the files aligned with this centre point marker as you scroll vertically.
16. Inserted block of text
This block of text is present only in the right-hand file. The connecting lines show you exactly where the text would have to be inserted in the left file to make the two files identical.
17. Edit marker
These show you whether a line has been edited or copied from another file.
18. Insertion point
A thin vertical line indicates where within the line text has been inserted in the other file.
19. Context menu (not shown)
Right-click either file panel to display a context menu containing shortcuts to useful commands. The Explorer context menu for the file is also available from this menu.
20. Block of changed text and in-line highlighting
This block of text is different in the two files. The linking lines show the related block of text in the other file. You can change the font and colours used for blocks of changed text in the Options dialog.
Notice that only the changed text within the line is highlighted. This enables you to quickly pinpoint inserts, removals or changes even in long lines of text.
21. Linking lines
The linking lines connect corresponding parts of the files, showing exactly how they are related.
22. Previous/Next change buttons
Use these buttons to jump quickly between each change in the files.
23. Status bar (including change summary)
The status bar shows the character encoding of the currently selected file and a count of the changes between the files.
1. Report button
Click this button to create a report of the folder comparison in HTML, HTML slideshow or XML format. HTML reports are particularly useful for archiving and distribution.
A folder comparison report can, optionally, include file comparison reports for some or all of the files involved in the folder comparison. Thus, it is possible, in one operation, to generate a report that is a complete record of all the differences in all of files involved in a folder comparison. This is especially useful in code review and audit situations.
2. Copy selected button
Click this button to display a menu that enables you merge folders by copying the selected files from one folder tree to another. You may also copy the files to an alternative destination.
3. Launch file comparisons for selection button
Click this button to open file comparison windows for all the selected pairs (or triplets, for three-way folder comparisons) of files.
4. Three-way comparison button (Professional Edition only)
Click this toolbar button to change to a three-way folder comparison view.
5. Select changed command
This selects all the pairs (or triplets, for three-way folder comparisons) of changed files. Choosing this followed by Launch comparisons is a quick way to open file comparisons for every pair of changed files.
6. Browse for folder button
Click the ... button to browse for a particular folder, or choose a folder you have previously used from the drop-down list. Alternatively, type a folder path directly into the entry field or drag and drop a folder from the Windows Explorer.
7. Column separator
Drag column separators in the header area to change column widths.
8. Inserted file
This file is present only in the right folder hierarchy. This is indicated by the background colour and the absence of an adjacent file in the left folder hierarchy.
9. Changed file
Changed pairs of files are indicated with an icon containing an information motif. The icon of the most recently changed file of each pair has a small red dot adornment.
10. Overview strip
This gives you an immediate idea of the extent of the differences between the folder hierarchies being compared. Each colour-coded mark on the strip represents a difference. You can click on an overview strip mark to jump directly to the corresponding change.
11. Context menu (not shown)
Right-click the folder comparison window to display a context menu containing shortcuts to useful features. The Explorer context menu for the selected files is also available from this menu.
12. Selected files
You can select multiple pairs (or triplets, for three-way comparisons) of changed files and then choose Launch File Comparisons For Selection to open file comparison windows for them all.
13. Change count
If enabled from the Options menu, the change count column indicates the number of changes between each pair of files.
14. Collapse folder
You can collapse folders in which you are not interested by clicking the button the left of the folder icon. Click again to expand.
15. Select… command
This command enables you to select files and folders according to criteria you specify.
16. Removed file
This file is present only in the left folder hierarchy. This is indicated by the background colour and the absence of an adjacent file in the right folder hierarchy.
17. Status bar
The status bar shows the number of each type of change (removals, insertions and changes) between the folder hierarchies being compared.
The professional edition allows for automatic merging of nonconflicting code differences and also allows for three-way merging of code differences for developers working in a team environment. Araxis Merge also allows you to generate comparison statistics and reports in HTML, XML, or Unix diff format, allowing you to easily visualize the changes in your code over time. Another great feature of Araxis Merge is the availability of an extensibility API that allows you to customize the way in which Araxis Merge operates, using C#, VB.NET, C++, or even the Windows scripting host.
This API is fully documented within the online help provided with the product Araxis Merge is without a doubt the best file- and folder-differencing program that I have discovered to date –and it’s now an integral part of my day. Currently, Araxis Merge does integrate with some configuration management applications such as Rational Clear Case. However, according to the Araxis Merge Web site, Microsoft Visual SourceSafe currently does not allow for the integration of third-party compare and merge utilities. The only thing I can think of that would improve Araxis Merge would be if it were to fully integrate into the VS.NET environment.
On my last two projects Araxis Merge has been a true life-saver, enabling me to compare the code that appears in the Microsoft Word document for the chapter with the equivalent code that is displayed in the VS.NET solution found on the book’s CD by just cutting and pasting the corresponding method or class into Araxis Merge using the editing features already in place. Araxis Merge is available as a small download, allowing you to experience these and other great features for 30 days. I highly encourage you to check it out.
Guiffy
This program better for Mac users, it has 21 day trial version. You can try it for free and look what is is better for you.
File Compare
Here is Guiffy with a diff of two code files which are the same, pretty much what you would expect. The syntax highlighting is well done:
Archive Compare (new for v9)
To test Archive Compare I compared the .zip files of two different versions of the Guiffy installer. File selection shares the same dialog as the Folder Compare and works like you would expect.
The actually comparison was relatively quick and accurate (I compared gufins86.zip and gufins90.zip) and displayed the results as if I were comparing folders (which essentially this is a similar operation) in hierarchical fashion. The beautiful thing is that Guiffy actually went into the .app file within the .zip archive (the .app file is the installer) which is nice as some diff tools just stop at unzipping the .zip file. If that were the case here we would only see the guf86ins.app and gufins90.app files in the compare – glad this is NOT the case with Guiffy.
Here is a screen shot showing the results:
Folder Compare
Ok, so let’s look at a Folder diff of a fairly large chunk of Flex source for a grocery cart (from one of my training books).
I first modified the options by selecting Show SubFolders (Recursively) and Show Details. The recursive part is important to me as I have used diff tools which made you navigate into a folder to see the differences in that folder then you had to navigate out – pain!
WinMerge
If you like open source projects WinMerge is not bad too. This tools is an open source project, which means that the program is maintained and developed by volunteers. If you are interested in contributing work to the project, see our developer page for further information on how you may contribute. In addition, WinMerge is translated into a number of different languages. See our information on translating WinMerge into your own language.
File compare window is basically two files opened to editor into two horizontal panes. Editing allows user to easily do small changes without need to open files in other editor or development environment.
In the tree view, folders are expandable and collapsible, containing files and subfolders. This is useful for easier navigation in deeply nested directory structures. The tree view is available only in recursive compares.
Byond compare
Beyond Compare 3 is the ideal tool for comparing files and folders on your Windows or Linux system. Visualize changes in your code and carefully reconcile them. BC3 means 3-way merge. Merge your changes with someone else's using a common ancestor as a basis. Interfaces with popular version control systems. Folder synchronization just got a whole lot easier. Manage rollouts, update your website, backup your laptop. Copy only the data that's changed for quicker syncs.
Beyond Compare allows you to quickly and easily compare your files and folders. By using simple, powerful commands you can focus on the differences you're interested in and ignore those you're not. You can then merge the changes, synchronize your files, and generate reports for your records.
You can compare entire drives and folders at high speed, checking just sizes and modified times. Or, thoroughly verify every file with byte-by-byte comparisons. FTP sites and zip files are integrated seamlessly, so you can update your website with the touch of a button.
Once you've found specific files you're interested in, Beyond Compare can intelligently pick the best way to compare and display them. Text files can be viewed and edited with syntax highlighting and comparison rules tweaked specifically for documents, source code, and HTML. Data files, executables, binary data, and images all have dedicated viewers as well, so you always have a clear view of the changes.
3-way Merge (pro version)
Introduced in version 3, Beyond Compare's new merge view allows you to combine changes from two versions of a file into a single output. Its intelligent approach lets you quickly accept most changes while carefully examining conflicts. Color coding and section highlighting enable you to accept, reject, or combine changes, directly and promptly. And, you can change any line in the output with the built-in syntax-highlighting editor. By using Beyond Compare's powerful file type support and ability to favor changes from one file, you can trivially accept many changes without even seeing them.
You can use Beyond Compare directly from most version control systems, giving you all of the powerful comparing and merging support you need when you need it most. Integrated source control commands are also available, allowing you to check in and see files without interrupting your work.
Summary:
My favourite merge tools is Araxis, because I'm Windows user and I like to make big merges in one place and fast I use it very easily, it can help to merge big branches of code for me many times. Guiffy is a professional Diff/Merge tool and does a great job of providing professional grade features – check it out! Also you can you WinMerge tool and you always can fix some bug in open source project, because community of people always share this project between each other it will grow without any sponsors ever. At the end of this post I want to ask all of you what tools are you using for merge and difference of code and why?
References:
Araxis web site
Guffy Merge web site
Download guffy merge for free version
WinMerge open source project
Last version WinMerge tools download
Download Beyond Compare tool