History Command
Displays the revision history for one or more files, folders or both.
Required Permissions
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.
tf history itemspec [/version:versionspec]
[/stopafter:number] [/recursive] [/user:username]
[/format:(brief|detailed)] [/slotmode] [/itemmode] [/noprompt] [/login:username,[password]] [/sort:ascending,descending] [/collection:TeamProjectCollectionUrl]
Parameters
Argument |
Description |
---|---|
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 (Version Control). |
number |
Specifies how many changesets should be included in the history query. |
TeamProjectCollectionUrl |
The URL of the team project collection that contains one or more files or folders about which you want to display the revision history (for example, http://myserver:8080/tfs/DefaultCollection). |
username |
Provides a value to the /login and /user options. You can specify a username value as either DOMAIN\UserName or UserName. |
Option |
Description |
---|---|
/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 changeset numbers that you specify. |
/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. If you have renamed a file, this option shows the revision history for the file under both the old and the new name. |
/noprompt |
Suppresses any prompts for input from you. |
/itemmode |
Displays the revision history for the specified item that has a unique path. Unlike the /slotmode option, if you renamed a file, this option would show the revision history for the file only under new name. |
/collection |
Specifies the team project collection. |
/login |
Specifies the user name and password to authenticate the user with Visual Studio Team Foundation Server. |
/sort |
Sorts the revision history for one or more files or folders in either of the following orders:
|
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 context menu, use the copy option to copy the text information in the currently selected rows to the clipboard. For more information, see Using 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 version 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 the specified item. For example, if you have renamed a file, this option shows the old and the new name. 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 version control server and the workspaces that map to it, see Informational Commands.
For more information on how to find the tf command-line utility, see Tf Command-Line Utility 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
See Also
Reference
Command-Line Syntax (Version Control)
Concepts
Other Resources
Tf Command-Line Utility Commands