Getting Started

WinMerge is helpful for tasks such as determining how a project has changed since a previous release or migrating changes to a previous version. WinMerge can view differences in directory mode, displaying those files which have been changed from one version to the next, and allowing you to individually view and edit files that have been changed. It can also be used as a directory synchronization tool.

Most of what you will use in WinMerge can be found on the toolbar. The functions are also available via menu or keystroke. Here's a short description of each of the toolbar buttons.

Button Description Keystroke
Open Begins a new comparison session by displaying the Open dialog Ctrl+O
Save Saves changes you have made in either file Ctrl+S
Undo Undoes the previous operation Ctrl+Z
Redo Redoes the previous operation Ctrl+Y
Next Difference Moves to the next difference in the open difference window Alt+Down Arrow
Previous Difference Moves to the previous difference in the open difference window Alt+Up Arrow
Last Difference Moves to the last difference in the open difference window Alt+End
Current Difference Moves to the current difference in the open difference window Alt+Enter
First Difference Moves to the first difference in the open difference window Alt+Home
Copy to Right Copies the selected difference in the left file to the right file Alt+Right Arrow
Copy to Left Copies the selected difference in the right file to the left file Alt+Left Arrow
Options Displays WinMerge options N/A
Copy All to Right Copies all differences in the left file to the right file N/A
Copy All to Left Copies all differences in the right file to the left file N/A
Refresh Refreshes the display, to show the current differences F5

Starting a Comparison Session

To start comparing files, click the Open button, which displays the Open dialog, shown below.

Open dialog

The Open dialog has two fields that are used to specify what you would like to compare. You can specify comparison objects in one of four ways:

  1. Enter the path names directly into the edit fields
  2. Click the Browse button and use the file chooser to navigate to the desired object
  3. Expand the combo box and select a previously entered path (WinMerge remembers the last 20)
  4. Drag & drop something into the edit field from Explorer

Note that if you enter an invalid path, or a path to a single file in one field and a directory path in the other, WinMerge will disable the OK button.

Also, a recursive option is supplied when comparing directories, which will recursively compare the contents of each subdirectory as well.

You may specify which extensions you would like to compare using the Extensions field. To compare all files in the selected directories, leave the field blank, or enter *.*

If you want to specify multiple extensions, enter a semi-colon separated list of extensions such as the following:

*.cpp;*.hpp;*.c;*.h

Drag & drop to the main window

You can drag and drop two files or two directories to the main window.

Using the Command Line

At the Command Line type:

winmerge [/r] [/e] [/ul] [/ur] [/ub] [leftpath] [rightpath] [outputpath]

To simplify comparisons and using the parameters, it is recommended that WinMerge be added to the application path variable in Window's environment settings. Once that is done, WinMerge can be invoked from any directory instead of just the application's home directory.

Filter Files

Filter files can help with setting several filtering options at once for both file comparison and directory comparison. Save the code in an ASCII file with a *.flt extension. Filters can be selected for a comparison session by clicking on Options under the Edit menu, then clicking on the Filter tab. There you can select the file using the drop-down select field. Save the file into the Filters folder under the WinMerge application folder.

Here is an example of the code in a filter file:

## This is a directory/file filter for WinMerge
## This filter suppresses various binaries found in Visual C++ source trees
name: Visual C++ loose

## This is an inclusive (loose) filter
## (it lets through everything not specified)
def: include

## Filters for filenames begin with f:
## Filters for directories begin with d:
## (Inline comments begin with " ##" and extend to the end of the line)

f: \.aps$ ## VC Binary version of resource file, for quick loading
f: \.bsc$ ## VC Browser database
f: \.clw$ ## VC class-wizard status file
f: \.dll$ ## Windows DLL
f: \.exe$ ## Windows/DOS executable
f: \.exp$ ## VC library export file
f: \\vc60.idb$ ## VC ?
f: \.ilk$ ## VC incremental linker memory file
f: \.lib$ ## compiled libraries
f: \.ncb$ ## VC parser information file (class view & component gallery stuff)
f: \.obj$ ## VC object module file
f: \.pch$ ## VC precompiled header file
f: \.pdb$ ## VC program database file (debugging symbolic information)
f: \.sbr$ ## VC source browser file (used to create bsc file)
f: \.res$ ## VC compiled resources file (output of RC [resource compiler])

d: \\cvs$ ## CVS control directory

You can find additional filter files to download at the WinMerge download site

If you have made some filters you would like to share with the rest of us, then please upload them as a WinMerge patch, then one of the developers will make sure they get on the download page.