There have already been many articles on the hub about distributed version control systems (DVCS), their comparisons, as well as comparisons of GUI clients for them. There were also discussions about IDE plugins for working with git and mercurial. But there was practically no information
about visual comparison and merge conflict resolution tools.
I recently “jumped” from mercurial (which I still find more convenient and logical) to git, because the vast majority of projects that are interesting to me use git and are hosted on github.
In this regard, the question arose about revising the arsenal of tools, in particular the question of choosing a tool
for visual comparison and merging (diff and merge). In order to fill the lack of information on the hub, I decided to write this mini-review. As they say - in hot pursuit.
Below the cut you will also find examples of Git settings for use with DiffMerge and WinMerge under Windows. I think it will save a lot of time.
Name | Peculiarities | Platform |
KDiff3
https://kdiff3.sourceforge.net/
[
]
Both git and mercurial users are likely to have come across this tool, but a couple of lines won't hurt.pros
:
- free;
- supports three-way merge;
- can compare directories;
- works fine with different encodings;
Minuses
:
- without additions does not highlight syntax.
Note: Installed with TortoiseHg.
Windows, Mac OS X, LinuxDiffMerge
https://www.sourcegear.com/diffmerge/index.html
[
]
pros:
- free;
- supports three-way merge;
- can compare directories.
Minuses
:
- There are problems when working with Cyrillic. I think they will fix it over time.
- DiffMerge by default does not support syntax highlighting for programming languages.
WinMerge
https://www.winmerge.org https://ru.wikipedia.org/wiki/Winmerge
[
]
pros:
- Open Source;
- no problems with encodings;
- syntax highlighting without unnecessary gestures;
- comparison of directories.
Minuses
:
- The merge tool is two-way, which can be inconvenient in some cases;
- Windows only.
Note
: I started using this tool a long time ago (even before I started using mercurial and git) and the fact that the merge tool is two-way in most cases does not cause much inconvenience.
Meld
https://meld.sourceforge.net/
[
]
pros:
- GPL v2;
- two-way and three-way file merging;
- comparison of directories;
- syntax highlighting (with GtkSourceView installed).
Minuses
:
- To install on Windows you need to install Python, GTK+, Glib, GtkSourceView, which not everyone will like.
Comparing files in Total Commander
To perform comparison operations between several files using this program, you need to select the first file to compare in one of the panels, and select the second in the second panel.
Then open the “file” menu item and go to the “compare by contents” item.
A window should appear divided into two columns. At the top of the columns there is a box with a file selection function. Having selected a file to compare, you will need to click the “compare” button.
The contents of the compared files will be displayed in two columns. Differences found in the files will be highlighted. To edit the contents of the file, you must click the “edit” button.
Diffuse
https://diffuse.sourceforge.net/
[
]
pros:
- GPL;
- support for 2-way, 3-way and n-way (any number of files) merge;
- syntax highlighting;
- works great with UTF-8;
- unlimited depth of cancellations (Undo);
- Convenient navigation through the code.
Minuses
:
- except perhaps the inability to compare directories.
Note
: When merging using the git mergetool command via Git Bash on Windows, a fourth “extra” window opens. You can remove it by editing the config c:/Git/libexec/git-core/mergetools/diffuse
: When installed on Windows, it already includes all the dependencies (unlike Meld), namely Python and the PyGTK package.
Program installation
After downloading the program installer, run it (the “ HashTab Setup.exe ” file) by clicking on it. The program installer window will open (Fig. 1):
Rice. 1. Installing the program.
Click the " Next " button. The following License Agreement window will open (Fig. 2):
Rice. 2. License agreement.
Click the " I Agree " button, then the " Install " button to begin the installation.
Once the installation is complete, click the “ Finish ” button.
TKDiff
https://sourceforge.net/projects/tkdiff/
[
]
pros:
- GPLv2;
- you can add bookmarks for differences;
- works fine with encodings;
Minuses
:
- the interface is less convenient and looks very poor (see screenshot) than that of other products.
- no syntax highlighting;
- can't compare directories.
SmartSynchronize
https://www.syntevo.com/smartsynchronize/index.html
[
]
pros:
- three-way merger;
- no problems with encodings;
- In addition to files, it can compare directories.
Minuses
:
- a license is required for commercial use;
- Syntax highlighting is not provided by default for programming languages. It is possible that something can be done.
Note
: SmartySynctonize is built into SmartGit, a convenient GUI tool for working with Git (also free for non-commercial use).
BeyondCompare
https://www.scootersoftware.com/ https://en.wikipedia.org/wiki/Beyond_Compare
[
]
pros:
- three-way merger;
- can compare files, directories, remote directories, archives, as well as MP3 files, images, etc. But the last points are, in principle, unnecessary functionality.
Minuses
:
- ShareWare;
- there is no version for Mac.
Compare PDF files online
If you don't want to install any software or you need an online tool to quickly compare PDF files, then a suitable online utility in PDF24 is what you need. PDF24 offers you various free online PDF utilities with which you can easily solve various PDF problems, and with one of these utilities, you can compare PDF files. Here's how it works:
- Just open the application from the link below.
- Drag and drop your PDF files into the appropriate area.
- The files have been downloaded and displayed.
- Start comparing the two files.
- After analysis, the results and differences will be displayed.
There are many programs for comparing text files such as TXT, DOC, etc. Such programs can easily compare two files and display in a report all the differences: what was deleted, what was added, and what was not edited and remained unchanged.
Programs for comparing files are often used by programmers, compilers of various instructions, technical specifications and other documentation, who have to periodically compare different versions of the same document or file.
But sometimes you may need to compare PDF files and determine the differences between them. This is where many people may have difficulties. The Adobe Acrobat file format - PDF - is very specific and conventional text comparison programs can no longer cope with it.
The most realistic, but not very simple, option for comparing PDF files for a long time was the following: PDF documents were recognized using a program like Fine Reader , converted into text files, for example MS Word (doc), and these text files were compared with a regular type comparison program CompareIt! or Ultra Compare . It is clear to everyone that this method is very inconvenient and labor-intensive; moreover, it is necessary to have two paid programs (for recognition and for comparison).
We have been waiting for this for a long time, and now, finally, Adobe took pity on its customers and implemented a PDF file comparison mechanism in its Adobe Acrobat Professional . There is no information about the 7th and 8th versions, but at least Acrobat PRO 9 and even more so Acrobat PRO 10 and Acrobat PRO 11 have a built-in file comparison function. To be honest, this tool was sorely missed a few years ago when there was a real need to compare large PDF files that were periodically modified by their vendor.
Araxis Merge
https://www.araxis.com/merge/
[
]
pros:
- three-way merger;
- no problems with encodings;
- highlights syntax;
- in addition to files, it can compare directories and synchronize them;
- works well when comparing large files (gigabytes) and large directories;
- generation of reports based on comparison results.
- Ribbon interface (if this can be called a plus).
Minuses
:
- ShareWare;
- there is no version for Linux.
Note
: in the comments, many praise and recommend this tool, despite the high cost.
In principle, all of the listed tools cope well with their tasks and this review is not a topic for debate
, because Everyone chooses an instrument to their taste. The following are examples of Git settings for working with DiffMerge and WinMerge. By analogy, you can configure the interaction of Git with other tools.
Compare PDF files and show differences
- SSL-protected file transfer
- Automatically delete a file from the server after one hour
- Servers are located in Germany
- SSL-protected file transfer
- Automatically delete a file from the server after one hour
- Servers are located in Germany
Select two files you want to compare and start comparing.
In a few seconds you will see the difference between these files. Your files do not have to be PDF. This utility supports all files that our system can convert to PDF. Conversion to PDF occurs automatically.
We have made it as easy as possible for you to compare documents. You don't need to install or configure anything, just select your files.
There are no special requirements on your system to compare two files. This application works on all major operating systems and browsers.
You don't need to install any applications. The files are compared on our servers. There are no special requirements for your system.
Our file comparison utility doesn't store your files any longer than necessary. Your files and results will be deleted from our server after some time.
A very good and simple application that allows me to quickly and easily see the differences between two similar files.
There is nothing easier to compare two files. Comparing two versions of a document becomes a breeze with this tool.
Git and DiffMerge
1) Add a diffmerge file with the following content to the c:/Git/libexec/git-core/mergetools/
: diff_cmd () { “c:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe” \ “$LOCAL” “ $REMOTE" >/dev/NULL 2>&1 } merge_cmd () { "c:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe" \ --merge --result="$MERGED" "$LOCAL" "$BASE » "$REMOTE" >/dev/NULL 2>&1 status=$?
} 2) Now add the following lines to the c:/Users/swipe/.gitconfig
: [diff] tool = diffmerge [merge] tool = diffmerge cmd = “diffmerge” trustExitCode = true 3) Create a conflict and call DiffMerge to resolve it git init // initialize the repository and create an empty file readme.txt git add . // add the created file to the index git commit -m “empty readme” // commit the changes git branch new // create a new branch git checkout new // switch to a new branch add a line to the readme.txt file git add . // add changes to the index git commit -m “new string” // commit changes to the new branch git checkout master // switch to the master branch and add changes to the readme.txt file git add . // add changes to the index git commit -m “master string” // commit them git hist —all // look at the tree git difftool master new // compare two branches
git merge new // merge the changes in new with the master branch
A message about a merge conflict is displayed, which is what we wanted.
git mergetool // resolve this conflict
In the middle window, we will bring the file to the required state and save the changes. The conflict has been resolved. I looked at the DiffMegre setup here: https://twobitlabs.com/2011/08/install-diffmerge-git-mac-os-x/
Windows Command Line
If you just need to compare files without editing, you can use the standard Windows 8 command line.
To do this, simply go to the Start menu, type cmd in the search bar and run the cmd.exe application found. Then enter the command fc /NXZ, where X is the path to the first document (for example, C:\Documents\text1.txt) and Z is the path to the second (for example, C:\Documents\text2.txt). The result should be a line like this: fc /NC:\Documents\text1.txt C:\Documents\text2.txt.
After entering the line, press Enter to start checking the files.
If there are few differences in the files, then this method will help identify them, but if there are a large number of differences between the documents, it is better to download another program.