Home > Tools > Custom Diff/Merge Tools in Team Foundation

Custom Diff/Merge Tools in Team Foundation

The default Diff/Merge Tool from Team Foundation is everything else than sophisticated… But who cares, it’s pretty easy to use your favorite Tools for Diffing and Merging.

Here’s where you find the Configuration Options:

  1. Start your Visual Studio
  2. Go to the Tools-Menu
  3. Open the Options
  4. Browse to Source Control
  5. Browse to Visual Studio Team Foundation Server
  6. Click the Configure User Tools… Button

There you can Add, Modify and Remove the individual Settings for different File-Extensions and Operations (Compare and Merge). Normally you want to use one Tool for Merging and one for Comparing, so just put .* into the Extension Field. The Command Field is where you select the Executable of your Tool and the Arguments define which Arguments and in which Order they should be passed to your Tool.

The Arguments are:

Arg. Name Description
%1 Original file In diff, the pre-changes file, in merge, the “server” or “theirs” file, the file that is the base file after “their” changes were applied
%2 Modified file In diff, the post-changes file, in merge the “yours” file – the base file with “your” changes applied
%3 Base file In the 3-way merge operation, the file which both “theirs” and “yours” are derived from – the common ancestor. This doesn’t mean it’s the version the changes were based from, since this may be a cherry-pick merge
%4 Merged file The output file for the merge operation – the filename that the merge tool should write to
%5 Diff command-line options Any additional command-line options you want to pass to your diff tool – this comes into play only when using “tf diff /options” from the command-line
%6 Original file label The label for the %1 file
%7 Modified file label The label for the %2 file
%8 Base file label The label for the %3 file
%9 Merged file label The label for the %4 file

Here’s a list of the most known Tools for Merging and Diffing:
 
Diff (Compare) Tools

Product Command Arguments
TFS default diffmerge.exe %1 %2 %6 %7 %5 /ignorespace
WinDiff windiff.exe %1 %2
DiffDoc (for Word files) DiffDoc.exe /M%1 /S%2
WinMerge winmerge.exe /ub /dl %6 /dr %7 %1 %2
Beyond Compare bc2.exe %1 %2 /title1=%6 /title2=%7
KDiff3 kdiff3.exe %1 –fname %6 %2 –fname %7
Araxis compare.exe /wait /2 /title1:%6 /title2:%7 %1 %2
Compare It! Wincmp3.exe %1 /=%6 %2 /=%7
SourceGear DiffMerge DiffMerge.exe /title1=%6 /title2=%7 %1 %2
Beyond Compare 3 BComp.exe %1 %2 /title1=%6 /title2=%7
TortoiseMerge TortoiseMerge.exe /base:%1 /mine:%2 /basename:%6 /minename:%7
Visual SlickEdit win\vsdiff.exe %1 %2

 
Merge tools

Product Command Arguments
TFS default diffmerge.exe /merge %1 %2 %3 %4 %6 %7
KDiff3 kdiff3.exe %3 –fname %8 %2 –fname %7 %1 –fname %6 -o %4
Visual SourceSafe ssexp.exe /merge %1 %2 %3 %4 %6 %7
Araxis compare.exe /wait /swap /a3 /3 /title1:%6 /title2:%7 /title3:%8 %1 %2 %3 %4
Beyond Compare (2-way merge) bc2.exe %1 %2 /savetarget=%4 /title1=%6 /title2=%7
WinMerge (2-way merge) winmerge.exe /ub /dl %6 /dr %7 %1 %2 %4
Guiffy guiffy.exe -s -h1%6 -h2%7 -hm%9 %1 %2 %3 %4
Ellie Computing guimerge.exe –mode=merge3 %3 %1 %2 –to=%4 –title0=%8 –title1=%6 –title2=%7 –to-title=%9
SourceGear DiffMerge DiffMerge.exe /title1=%6 /title2=%8 /title3=%7 /result=%4 %1 %3 %2
Beyond Compare 3 BComp.exe %1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9
TortoiseMerge TortoiseMerge.exe /base:%3 /mine:%2 /theirs:%1 /basename:%8 /minename:%7 /theirsname:%6 /merged:%4 /mergedname:%9
Visual SlickEdit win\vsmerge.exe %3 %1 %2 %4

I prefer WinMerge for Comparing and TortoiseMerge for Merging (because it has a 3-Way-Merge).

Source: James Manning’s blog

Ad
Categories: Tools Tags: , , , ,
  1. molafish
    February 20th, 2010 at 05:13 | #1

    Great reference. I was just going through doing this myself with tortoisemerge (figuring out what to plug in from the command line options) in VS2010 when I thought that someone else probably has already documented it and found this page.

    One thing to note is that the TFS client built into VS (at least in 2010 RC) waits for the merge tool to close before you can accept the results from the merged window. So you can’t keep the tortoisemerge window open, which I often did with svn. Just something to keep in mind because it initially threw me…

  1. May 20th, 2009 at 09:30 | #1
*