Compares, and if it is possible displays differences between two files, files in two folders, or a shelveset and a local or a server file.
To use the difference command, you must have the Read permission for all specified items set to Allow. For more information, see Team Foundation Server Permissions.
tf diff[erence] itemspec [/version:versionspec] [/type:filetype] [/format:format [/ignorespace] [/ignoreeol] [/ignorecase] [/recursive] [/options]
tf diff[erence] itemspec itemspec2 [/type:filetype] [/format: format] [/ignorespace] [/ignoreeol] [/ignorecase] [/recursive] [/options]
tf diff[erence] [/shelveset:shelvesetname[;shelvesetowner]] shelveset_itemspec [/server: servername] [/type:filetype] [/format: format] [/ignorespace] [/ignoreeol] [/ignorecase] [/recursive] [/options]
tf diff[erence] /configure
Required. Specifies the item to be compared. If no version or path is specified, the current workspace version is assumed. Accepts both local and Team Foundation version control server paths.
For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Syntax (Team System).
The difference command does not support wildcard characters.
This parameter cannot be combined with the /shelveset option.
Optional. The item to which the itemspec is to be compared. If you do not provide a second itemspec, the latest Team Foundation version control server version of the item is used.
Provides a value for the /type option. You can specify "binary" or "text," and a codepage number or the friendly name for a codepage.
Used with the /format option to specify an output format of one of the following types:
These outputs formats are explained in the Remarks section of this topic.
The user-provided value for the /version option. For more information about how Team Foundation parses a version specification to determine which items are within its scope, see Command-Line Syntax (Team System).
The user-provided value for the /server option. Example: teamfoundation2.
Identifies the owner of the shelveset by user name. If a value for this parameter is not provided, the current user is assumed.
Specifies the name of a shelveset. Note that there can be more than one shelveset of the same name on the Team Foundation Server as long as each is owned by a different user.
Specifies the name of a folder or file in the shelveset to compare to the base shelveset version.
Overrides any detected encodings and uses the specified encoding to present the files to the differencing engine.
Specifies the version of the file or folder to compare. By default, Team Foundation uses the workspace version if you do not provide a versionspec.
Instead of using the /version flag, you can specify versions by appending a semicolon and version specifier to the end of each file name.
Specifies an output format specified by the format argument.
Does not highlight white-space differences between the compared files.
Ignores differences between the new line characters in two files or file versions. /ignoreeol works differently from /ignoreSpace. /ignorespace treats eight spaces identically to one. However, if you use the /ignoreeol option and File A has two new line characters between unchanged areas of text, and File B has one, the result displays as a difference. If both files have only one new line, but File A uses \r\n as a new line and File B uses \n, /ignoreEOL option would ignore that as a difference.
Does not highlight differences in letter casing between the compared files.
Compares the differences between the current folder and all its subfolders.
Specifies an option string for the tool to be invoked by diff. For more information, see How to: Associate a File Type with a Difference Tool and How to: Associate a File Type with a Merge Tool.
Identifies the Team Foundation Server. This option is required if the command is invoked from a directory that is not mapped to a workspace.
Specifies a shelveset to compare to the Team Foundation version control server version upon which the shelveset is based.
This option cannot be combined with an itemspec argument. To compare individual shelveset items, you can provide a shelveset_itemspec.
Suppresses any dialog boxes that would otherwise be displayed during the completion of this operation.
Invokes the Configure User Tools dialog box. This tool is available from the Visual Studio user interface. For more information, see How to: Associate a File Type with a Difference Tool.
You can type tf diff or tf difference at the command line to run this command.
You can use the difference command to compare and if it is possible, display differences between:
Two different files or two versions of the same file.
One or more of the items in a folder.
One, some, or all the items in a shelveset on the Team Foundation Server.
You can use the difference command to compare both versioned and non-versioned files.
Team Foundation categorizes all files by type. Text files can be merged and compared, side by side and line by line, as long as both files have the same encoding. If you want to compare two files whose encodings are not the same, you can temporarily mask, or override the encoding property for a file by using the /type option. Binary files can be compared but cannot be merged. When you pass one or more binary files to the difference command, Team Foundation indicates whether differences exist between it and the item to which it is being compared. For more information about how Team Foundation differentiates between and treats files of disparate types, see File Types.
If you specify two file names, the two files are compared. Instead of using the /version flag, you can specify versions by appending a semicolon and version specifier to the end of each file name.
If you pass only one itemspec to the difference command:
If do not provide a versionspec, your current workspace version of the item is compared to the base workspace version, by default. For example, tf difference header.h compares the current version of header.h to the version upon which header.h is based.
If you include a versionspec in your itemspec such as , tf difference header.h;LBeta1, Team Foundation compares that version to your current workspace version on disk.
If you specify a range of versions such as /version:C1~C4, the versions of the file at the two end points of the range are compared.
For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.
Output Format types
The format parameter, used with the /format option, specifies many different output formats. The available output types are
Visual format type opens an external difference application. By default diffmerge.exe is launched.
Brief format prints whether the files being compared differ.
Context format provides lines of context for the differences in the files. This format is derived from the UNIX based diff –c output format.
RCS format is similar to /format:unix, except context lines are not supplied.
No special handing for a missing end of line marker at the end of the file is provided.
SS is default difference output format for Visual SourceSafe. For more information, see "Diff (Command Line)" at the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=99139).
SS_SideBySide is the default side-by-side output format for Visual SourceSafe.
SS_Unix is similar to the /format:unix output format, but /format:ss_unix includes context lines and /format:unix does not.
Unified format is derived from the UNIX based diff –u output format. /format:context repeats identical context lines between the difference strings although /format:unified does not.
Unified format produces a new unified difference string (@@ ... @@) line only when the distance to the next difference string is larger than the number of context lines.
This output type is derived from the UNIX based diff command output format.
The Unix output format is constructed in the following way:
<metadataline> "< " line prefix for lines from the first file "---" line "> " line prefix for lines from the second file <metadataline> can be one of these possibilities: #a#,# -- add lines from line # in file1 into file2 at lines #-># #,#d# -- delete lines from line # -> # in file 1 from file2 at line # #,#c#,# -- change lines from line # -> # in file1 into the lines in file2 at line # -> # # signs seprated by commas indicate a line range. # signs before the character indicate line numbers in the first file # signs after the character indidicate line numbers in the second file /// No end of line marker at the end of the file: /// \ No newline at end of file
The following example displays the differences between the local version of 314.cs and the workspace version of 314.cs that is the version of the file that was checked out from the Team Foundation version control server.
c:\projects>tf difference 314.cs
The following example displays all files that have been changed in the src folder. Does not display files that have been changed in subfolders of src.
c:\projects>tf difference src /format:visual
The following example displays the differences between changeset 3 and changeset 8 of 1254.cs.
c:\projects>tf difference /version:C3~C8 1254.cs
The following examples display the differences between the version of 314.cs that belong to the label "release" and the version that belongs to changeset 3200.
c:\projects>tf difference 314.cs;Lrelease 314.cs;C3200
c:\projects>tf difference 314.cs;Lrelease~C3200
The following example displays the difference between the versions of e271.cs that a user named Nadia shelved in shelveset PeerCodeReview8 and the base shelveset version that is the version upon which she based her changes. Also displays the types of changes pending against e271.cs when Nadia shelved.
c:\projects> tf difference /shelveset:PeerCodeReview8;Nadia e271.cs
The following example displays the differences between all files in the PeerCodeReview2 shelveset and the base shelveset version of those files.
c:\projects> tf difference /shelveset:PeerCodeReview2