Visual differences of changesets via command-line

August 24, 2009

Scenario : as a developer you want to manually view all the differences between the two last changesets without having to spend your time reviewing file after file in the UI differences window.

Go the command prompt and use the tf diff[erence] command:

tf diff source /version:C22~C23 /recursive /format:unified > C:\Temp\diff.txt

  • source is the name of the folder I want to recursively [/recursive] look up all differences
  • /version:C22~C23 means that I want to find only the differences between changeset 22 and changeset 23
  • /format:unified sets the output type to the Unified format derived from the UNIX based diff –u output format
  • > C:\Temp\diff.txt sends the output to the diff.txt textfile

When finished open the diff.txt file in an editor that supports a difference scheme. In the example below I used Notepad2 to load the output file in the diff scheme.

The information written into the textfile is only the specific region in each textfile that’s different from the previous changeset. It’s a nice way to visually review only the portions of a set of files that were changed. It will save you a lot of time if you otherwise would want to review file by file via the GUI.