Using KDiff for your TFS comparison and merging tool
Posted by Stefan Zvonar on January 4, 2011
TFS is a great source control solution, however it can be a pain when trying to merge or even compare code when merging branches together (especially when you cut and paste code into a new IF statement – the code comparison gets shuffled down considerably, making comparing the two changesets very difficult).
Thankfully, KDiff is a free tool which performs much better than the default tools (in my opinion).
You can download and install KDiff from here:
http://kdiff3.sourceforge.net/
Once you have installed Kdiff, it is now time to configure TFS.
Go to Tools -> Options:
Go to Source Control -> Visual Studio Team Foundation Server -> Configure User Tools:
You will now want to add two new operations for comparing and merging.
Note, in the following picture examples, replace ‘C:Program FilesKDiff3’ with the path where you have installed KDiff.
Compare operations
Note, the arguments are:
%1 –fname %6 %2 –fname %7
Merge operations
Note, the arguments are:
%3 –fname %8 %2 –fname %7 %1 –fname %6 -o %4
That should be it. This will now ensure that TFS will use the KDiff tool when comparing any type of file. Note, you can change these operations to be specific to certain code files (instead of an ‘.*’ extension, you could use ‘.vb’, for example)
If you would like more information on the arguments used or use a different comparison tool, please read the following informative post:
Hope this helps,
Stefan.
-
stefanzvonar.com – A collection of articles on computer programming, software development, data analysis and other technical tidbits.
-




Anonymous said
Be careful copying and pasting the arguments as they won’t work as shown. The page has converted double dashes (–) to a single em-dash character. Check the screen shots to see the correct use of dashes.