Compartir vía


Get the history of an item

TFS 2018

Visual Studio 2019 | Visual Studio 2022

One advantage of a version control system is that you can look back in time to get detailed information about what changes have been made to your files. Team Foundation Version Control (TFVC) maintains historical data related to every version of every file that's ever been checked in.

Often when you look over the history of a file, folder, or branch, you're trying to solve a problem or answer a question. By using the History window in Visual Studio, you can more easily resolve questions and situations such as the following:

  • What changes have been made in the past weeks or months?

  • What work item was completed by this change to the file?

  • Who checked in this change? What did they say about the change? What did they change?

  • If unexpected changes occurred in this file, causing a bug in an area of the product that the team thought was stable, who made this change, and why?

  • If a change in this branch fixes a bug that also needs to be fixed in other branches, how can you make sure that the change is merged to those branches?

Use the Visual Studio History window to get detailed historical data about a project, branch, folder, or file.

Prerequisites

You must be one of the Contributors for your project. To learn more, see Default TFVC permissions.

Open the History window

To open the History window from Visual Studio, right-click an item in Source Control Explorer and then choose View History.

Tip

You can customize the position of the window by right-clicking the title and then choosing Float, Dock, or Set Tab Layout.

You can also use the command-line History command to open the window in Visual Studio.

The History window displays the historical data about the item in two tabs:

  • The Changesets tab lists every change made to the item, including edits, renames, and merges.

  • The Labels tab lists every label that has been applied to the item.

Changesets tab

The Changesets tab displays detailed data about every change that has been made to an item. All changesets that have modified the item are listed in a table that includes the following columns:

  • Changeset: The ID of the changeset.

  • User: The name of the user who checked in the changeset.

  • Date: The date and time the changeset was checked in.

  • Comment: The comment entered by the user who checked in the changeset.

Files also display data in the following columns:

  • Change: The types of changes that were made to the file with the changeset. Examples of values that can appear in this column include add, edit, rename, and merge.

  • Path: The path to the file.

Note

If you open the History window by using the tf history command, and you display data about a project, branch, or folder, the history of child items like files contained in a folder appears only if you use the /recursive option.

Tip

Sometimes you need to share this kind of data with someone else. You can select one or more rows from the table in the Changesets tab, right-click them, select Copy to copy the data to the clipboard, and then paste the data into an e-mail message, document, or spreadsheet.

Common tasks

By using the Changesets tab, you can do the following tasks:

Task

Supporting content

  • View the item as it existed when the changeset was checked in: Double-click or right-click the changeset, and then select View. This command is available only if the item is a file.

None

  • Get more details about a changeset: Right-click a changeset and then select Changeset Details to get information such as:

  • Other source files that are part of the changeset.

  • Work items associated with the changeset.

  • Any check-in notes left for reviewers.

  • Compare a past version with the current version: Right-click a changeset and then select Compare.

  • Compare a past version with another past version: Select two changesets by using Ctrl+Select, then right-click one of the changesets and select Compare.

  • Get a past version of the item: Right-click a changeset and then select Get This Version to download the past version of the item to your workspace.
  • View which users made specific changes within a file: Right-click a changeset and then select Annotate. This command is available only if the item is a file.
  • Get more details about a merge: If the changeset resulted from a merge, you can expand this item to display the changesets that were merged into this item from another branch. This command is available only if the item is a file.

None

  • Get more details about changes that were made before a rename change: If the changeset includes a rename, you can expand this item to display the changesets that occurred before the rename change was made.

None

  • View other branches to which this changeset has been merged: Right-click the changeset and select Track Changeset.
  • Roll back changes from one changeset: Select a single changeset and choose Rollback Entire Changeset.
  • Roll back changes from two or more consecutive changesets: Select a set of consecutive changesets and choose Rollback.
  • Display non-recursive history of a folder: You can get this data only from the command prompt.

Labels tab

All labels that have been applied to the item are listed in a table that includes the following columns:

  • Name: The name of the label.

  • User: The user who applied the label.

  • Date: The date and time the label was applied.

  • Changeset: The changeset to which the label applies.

  • Comment: The comment made by the user who applied the label.

Note

When you display historical data about a project, branch, or folder, the data about labels applied to child items, like the files in a folder, isn't shown.

Tip

Sometimes you need to share this kind of data with someone else. You can select one or more rows from the table in the Labels tab, right-click them, select Copy to copy the data to the clipboard, and then paste the data into an e-mail message, document, or spreadsheet.

Common tasks

Task

Supporting content

  • View the item as it existed when the labeled changeset was checked in: Right-click a label and then select View. This command is available only if the item is a file.

None

  • Edit the label: Right-click the label and select Edit Label.
  • Delete the label: Right-click the label and select Delete Label.
  • Compare a past version of the item with the current version: Right-click a label and then select Compare to compare a past version of the item with the current version.
  • Get a past version of the item: Right-click a label and then select Get This Version to download the past version of the item to your workspace.
  • View other branches to which the labeled changeset has merged: Right-click the label and select Track Changeset. This command is available only if the item is a file.
  • View which users made specific changes within the labeled version of a file: Right-click a changeset and then select Annotate. This command is available only if the item is a file.