History Command

Displays the revision history of one or more files or folders. The data is displayed in either the History window, or if /noprompt option is specified, at the command prompt.

Requirements: See Team Foundation Server Permissions.

tf hist[ory] itemspec [/version:versionspec] 
[/stopafter:number] [/recursive] [/user:username] 
[/format:(brief|detailed)] [/slotmode] [/itemmode] [/noprompt]
[/login:username,[password]] [/sort:ascending,descending]
[/collection:TeamProjectCollectionUrl]

Parameter

Description

/collection: TeamProjectCollectionUrl

Specifies the URL of the team project collection that contains the items. For example: http://myserver:8080/tfs/DefaultCollection.

By default, the team project collection is presumed to be the one that contains the workspace that maps the current directory.

/format

Specifies how much detail to display about each changeset when the /noprompt option is specified:

  • Brief (default): Displays one line about each changeset that includes: ID number, changes made, user who made the changes, date, and comment. Some of the data may be truncated.

  • Detailed: Displays a full description of each changeset. In addition to the above information, this option displays additional data such as date with time, items changed, check-in notes, and check-in policy warnings.

/itemmode

You cannot combine this option with the /slotmode option. See Matt Mitrik: Changing to Slot Mode in TFS 2010 Version Control.

itemspec

Specifies the items for which to display history. For syntax, see Team Foundation Version Control Command Reference.

/noprompt

This option:

  • Suppresses the display of windows and dialog boxes (such as the History window) and redirects output data to the command prompt. See Team Foundation Version Control Command Reference.

  • Does not display the history of revisions that occurred before an item was moved, renamed, branched, or merged.

/login:username,[password]

Specifies the user account to run the command. See Team Foundation Version Control Command Reference.

/recursive

Recursively retrieves historical data on items in the specified directory and any subdirectories.

/slotmode

You cannot combine this option with the /itemmode option. See Matt Mitrik: Changing to Slot Mode in TFS 2010 Version Control.

/sort

Sorts the revision history for one or more files or folders in either of the following orders:

  • Ascending: from the oldest to the most recent revision.

  • Descending (default): from the most recent to the oldest revision.

You must use the /noprompt option with this option.

/stopafter:number

Specifies the maximum number of changesets to display in the history data.

/user:username

Filters the historical data to show changes made by the specified user. An asterisk (*) symbol includes data on changes from all users (the default).

/version:versionspec

Specifies one of the following limits on the history data:

  • The maximum version

  • The minimum and the maximum versions using the range ~ syntax.

The default is /version:W (the version in the workspace).

For syntax, see Team Foundation Version Control Command Reference.

You cannot combine this option with the /slotmode option.

c:\code\SiteApp\Main\SolutionA\Project1>tf history program2.cs

Displays all changes made to program.cs in the History window.

c:\code\SiteApp\Main\SolutionA\Project1>tf history program2.cs /noprompt

Displays all changes made to program.cs in the command prompt window. For example:

Changeset Change                     User              Date       Comment
--------- -------------------------- ----------------- ---------- -------- 
29        edit                       Peter Waxman      4/23/2012  Fix bug
20        add                        Julia Ilyina      4/12/2012  Add new  

c:\code\SiteApp\Main\SolutionA>tf history * /recursive

Displays all changes made to all items in SolutionA (including those in subfolders) in the History window.

c:\code\SiteApp\Main\SolutionA>tf history * /noprompt /recursive /stopafter:5

Displays the latest 5 changes made to items in SolutionA (including those in subfolders):

Changeset User              Date       Comment
--------- ----------------- ---------- ----------------------------------------
31        Julia Ilyina      5/15/2012
30        Julia Ilyina      4/23/2012
29        Peter Waxman      4/23/2012  Fix bug in new method
20        Julia Ilyina      4/12/2012  Add new method, add program2.cs to Proje
15        Julia Ilyina      4/8/2012

c:\code\SiteApp\Main\SolutionA>tf history /noprompt * /recursive /v:30

Displays changes made to all items in SolutionA (including those in subfolders) in version 30 and earlier:

Changeset User              Date       Comment
--------- ----------------- ---------- ----------------------------------------
30        Julia Ilyina      4/23/2012
29        Peter Waxman      4/23/2012  Fix bug in new method
20        Julia Ilyina      4/12/2012  Add new method, add program2.cs to 15        Julia Ilyina      4/8/2012

c:\code\SiteApp\Main\SolutionA>tf history /noprompt * /recursive /v:D4/24/2012

-- or --

c:\code\SiteApp\Main\SolutionA>tf history /noprompt * /recursive /v:D2012-04-24T12:00

Displays changes made to all items in SolutionA (including those in subfolders) on 4/23/12 or earlier:

Changeset User              Date       Comment
--------- ----------------- ---------- ----------------------------------------
30        Julia Ilyina      4/23/2012
29        Peter Waxman      4/23/2012  Fix bug in new method
20        Julia Ilyina      4/12/2012  Add new method, add program2.cs to 15        Julia Ilyina      4/8/2012

c:\code\SiteApp\Main\SolutionA>tf history /noprompt * /recursive /v:D4/12/2012~D4/24/2012

Displays changes made to all items in SolutionA (including those in subfolders) between 4/12/2012 and 4/23/12:

Changeset User              Date       Comment
--------- ----------------- ---------- ----------------------------------------
30        Julia Ilyina      4/23/2012
29        Peter Waxman      4/23/2012  Fix bug in new method
20        Julia Ilyina      4/12/2012  Add new method, add program2.cs to 

c:\code\SiteApp\Main\SolutionA>tf history /noprompt * /recursive /v:D4/12/2012~D4/24/2012 /format:detailed

Displays details about changes made to all items in SolutionA (including those in subfolders) between 4/12/2012 and 4/23/12:

-------------------------------------------------------------------------------
Changeset: 30
User: Julia Ilyina (Fabrikam)
Date: Monday, April 23, 2012 1:23:05 PM

Comment:
  Much better name for this file

Items:
  rename                $/SiteApp/Main/SolutionA/Project1/programBig.cs
  delete, source rename $/SiteApp/Main/SolutionA/Project1/program3.cs;X15

-------------------------------------------------------------------------------
Changeset: 29
User: Julia Ilyina (Fabrikam)
Date: Monday, April 23, 2012 1:03:13 PM

Comment:
  Fix bug in new method

Items:
  edit $/SiteApp/Main/SolutionA/Project1/program1.cs
  edit $/SiteApp/Main/SolutionA/Project1/program2.cs

-------------------------------------------------------------------------------
Changeset: 20
User: Julia Ilyina (Fabrikam)
Date: Thursday, April 12, 2012 5:09:35 PM

Comment:
  Add new method, add program2.cs to Project1

Items:
  add $/SiteApp/Main/SolutionA/Project1/program2.cs


Check-in Notes:
  Documentation:
    An important new part of our codebase.

Policy Warnings:
  Override Reason:
    Peter agrees with me that we can bypass for this check-in.
  Messages:
    The Code Analysis Policy requires files to be checked in through Visual
Studio with an open solution.

c:\code\SiteApp\Main\SolutionA>tf history .

Displays the history of the SolutionA folder in the History window, which enables you to explore earlier changes to the folder. For example, if the most recent change to the folder was a rename, you can expand the changeset to see changes that occurred before the rename.

c:\code\SiteApp\Main\SolutionA>tf history . /noprompt

Displays the most recent change to the SolutionA folder in the command prompt window.

  • Tip For information about how to use the History window, see Get the History of an Item.

  • Tip To get more detailed information about a changeset (for example, you want to see associated work items):

    • In the History window, double-click the changeset or open its shortcut menu and choose Changeset Details.

    • From the command prompt, use the Changeset Command.

  • Tip For more information about changesets, see Find and View Changesets.

  • Tip The /collection option is useful for running this command from a machine and user account that does not have a workspace mapped to the Team Project Collection that contains the items.

  • Tip See View and Manage Past Versions.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft