Stefan Zvonar

A collection of articles about software development, data analysis and other technical tidbits

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:

Options

Go to Source Control -> Visual Studio Team Foundation Server -> Configure User Tools:

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

Compare Operator

Note, the arguments are:

%1 –fname %6 %2 –fname %7

Merge operations

Merge Operator

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:

http://blogs.msdn.com/b/jmanning/archive/2006/02/20/diff-merge-configuration-in-team-foundation-common-command-and-argument-values.aspx

Hope this helps,

Stefan.

-
stefanzvonar.com – A collection of articles on computer programming, software development, data analysis and other technical tidbits.
-

About these ads

6 Responses to “Using KDiff for your TFS comparison and merging tool”

  1. 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.

  2. […] having gone totally bonkers with this approach. And if you still don’t like git, consider setting KDiff as your standard TFS merging tool, it will help a […]

  3. gaming said

    Sometimes, the software to be installed is compressed in a.
    These are just number of of the numerous issues we have with regard to this new technologies.
    It is recommended having at least a 500GB hard drive.

  4. Hello, Neat posting. There exists a trouble with your website around website internet explorer, would examine the following? Internet explorer nevertheless could be the industry main as well as a huge area of some others will probably pass up your own fantastic publishing for this reason issue.

  5. […] being merged together. You can’t do this in a standard left/right viewer. Visual Studio can be configured to use KDiff3 instead of the built-in TFS merge tool when using […]

  6. Mei said

    It’s an awesome piece of writing designed for all the internet visitors; they will obtain advantage from it I am sure.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: