History Command

Displays the revision history for one or more files and folders.

tf history [/server:servername] itemspec [/version:versionspec] 
[/stopafter:number] [/recursive] [/user:username] 
[/format:(brief|detailed)] [/slotmode] [/noprompt]

Parameters

Argument Description

servername

The user-provided value for the /server option. Example: teamfoundation2.

itemspec

Identifies the file or folder for which to display history. For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Options.

versionspec

Provides a value such as C58 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.

number

Specifies how many changesets should be included in the history query.

username

Provides a value to the /user option. Depending on the network settings, you can specify either DOMAIN\username or username.

Option Description

/server

Identifies the Team Foundation Server. This option is required if the command is invoked from a directory that is not mapped to a workspace.

/version

Specifies the version of the items for which to display revision history. By default, Team Foundation uses the workspace version.

You cannot combine this option with the /slotmode option.

/stopafter

Displays history for the number of changesets that you specify. For example /stopafter:10 displays the last ten changes that occurred to the item specified.

/recursive

Retrieves historical information about items under the specified path.

/user

Filters the list of changes to the named user. An asterisk (*) can be used to select all users. If unspecified, all users are selected.

/format

Specifies the descriptions displayed for the historical information.

Brief displays one line about each changeset. Detailed displays a full description of the changeset. If unspecified, the descriptions are brief.

/slotmode

Displays revision history for all items that have ever occupied the specified namespace location.

/noprompt

Suppresses any prompts for input from you.

Remarks

The history command opens the History window displaying buttons to select Details, View, and Compare. Details displays changeset details. View displays versions of files. Compare compares file versions either with your current workspace version if only one row is selected or with two different versions if two rows are selected. From the History window shortcut menu, use the "copy" option to copy the text information in the currently selected rows to the clipboard. For more information, see Understanding the History Window.

You can use the history command to display revision history for one or more files and folders. For each changeset in which the requested items were included, Team Foundation displays a revision entry in the changeset output. Changeset details include information about the user who committed the change to the Team Foundation source control server, the files and folders for which pending changes were committed, the type of pending change that was committed, the changeset number, and the date and time when the changeset was created.

If you provide no versionspec, Team Foundation displays the file or folder’s complete history. When you provide a single version specification, Team Foundation displays information about the item from that version back to version 1. If you specify a range of versions (using the ~ syntax), the history for those versions and all versions in between is shown. You can specify a range in either ascending or descending order.

If you include the /slotmode option, Team Foundation displays revision history for all items which have ever occupied that specified namespace location. Because the /slotmode option specifies a range of disparate items and versions, you should not combine the /slotmode and /version options.

You can use the history command to determine the changeset number in which a set of files were committed and then use the changeset command to display more details about the nature of the changeset and the check-in that created it. Or, from the History window, you can select a row and then click the Details button.

For links to other Team Foundation commands that provide additional information about the items in your Team Foundation source control server and the workspaces that map to it, see Informational Commands.

Examples

The following example displays the changes that occurred between changeset version 5 and changeset version 8 to 1256.c.

c:\projects> tf history /version:C5~C8 1256.c

The following example displays the last ten changes that occurred for 314.cs.

c:\projects> tf history /stopafter:10 314.cs

The following example displays the detailed output formatted history of the 1256.c namespace slot.

c:\projects> tf history /format:detailed /slotmode 1256.c

Security

To use the history command, you must have Read permission set to Allow for all files or folders for which history is requested. For more information, see Team Foundation Server Permissions.

See Also

Reference

Command-Line Syntax
Changeset Command

Concepts

Working with Source Control Changesets
Informational Commands

Other Resources

Tf Command-Line Utility Commands
Viewing Historical Data
Viewing Historical Data