Partajați prin


Develop code and manage pending changes

TFS 2017 | TFS 2015 | TFS 2013

Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | Visual Studio 2013

Most changes that you make to your files are queued as pending changes. As you work, you can organize, manage, and get details about what you've changed.

Work in Solution Explorer

From the team explorer home page (Keyboard: Ctrl + 0, H), you can begin coding in a new or in an existing solution.

Open a solution from the Team Explorer Home page
After you open your solution, open the solution explorer (Keyboard: Ctrl + Alt + L).

Solution Explorer with Test and Class projects
When you open and modify a file from the solution explorer, the file is automatically checked out for you. Icons appear to indicate which files you have not changed TFSC Checked-In Status Icon, those you have checked out TFSC Checked-Out Status Icon, and those you have added to the solution TFSC Pending Addition Status Icon.

If you're working in a solution that contains a lot of files, you'll probably find it convenient to filter the solution explorer to show only the files you have changed Changes filter (Keyboard: Ctrl + [, P).

Use the My Work page to manage your work

If you're using Visual Studio Premium or Visual Studio Ultimate, you can use the My Work (Keyboard: Ctrl + 0, M) page in the team explorer to manage your work.

To Do List on My Work Page in Team Navigator
You can use My Work to:

  • Track your work against work items
  • Suspend and later resume your work (including file changes, associated work items, and Visual Studio state such as window positions and breakpoints)
  • Request a code review

For a step-by-step example, see Day in the life of an devops Developer: Write new code for a user story, and Day in the life of a devops Developer: Suspend work, fix a bug, and conduct a code review.

Tips

  • You can control the kinds of work items that appear in the Available Work Items section. Choose one of the default options or any of your personal queries that are contained in the root My Queries folder. To work with these queries, in the team explorer choose Home icon Home, and then choose Work Items.
  • When you move a work item to Available, In Progress, or Suspended, the work item state or comments are updated so that your team is automatically advised on the status of your work. For example, the task board for your team is updated to show your status. See Collaborate [redirected].
  • If your project contains customized work item type definitions, you might have problems using My Work, unless an Administrator for your project has taken certain steps. See Configure and customize Agile planning tools for a project and Update a customized process template to access new features.

Use the Pending Changes page to manage your work

You can use the Pending Changes page (Keyboard: Ctrl + 0, P) in the team explorer to manage your work.

Checking in the pending changes

Tip

  • You can Undock undock the Pending Changes page from the team explorer and open it in a new window.
  • You can toggle between list and tree view from the actions menu.

Almost every change that you make to the files on your dev machine is stored in your workspace as a pending change until you check it in:

Work with automatically detected changes

If you are working in a local workspace, Visual Studio can detect changes that you make outside the system. If you edit a file outside Visual Studio (for example, in Notepad) the change automatically appears in your Included Changes.

If you add or remove a file outside Visual Studio, for example, in Windows Explorer (File Explorer in Windows 8), the Detected changes link appears in the Excluded Changes section. Choose this link if you want to include these changes. The Promote Candidate Changes dialog box appears. You can open the context menu of added items and choose Browse in Windows Explorer to display them or Delete from disk to delete them.

Note

Empty folders will not appear.

If items that you don't need to check in appear regularly in the Promote Candidate Changes dialog box, you can select one of them, open its context menu, and choose Ignore this local item to ignore the item. You can also choose Ignore by extension or Ignore by file name to create a file that will cause Visual Studio to systematically ignore this kind of file. For more information on .tfignore files, see Add files to the server.

Associate work items

It's a best practice to associate work items (such as tasks or bugs) with your changes. Under Related Work Items, drag work items from a query or add it by ID.

Exclude changes

See Specify the files you want to check in

See what you changed

You can remind yourself about what you've changed in a file.

Use Pending Changes to view what you changed

  • On the Pending Changes page, open the context menu for the item and choose:
    • Compare with Workspace Version to see what you've changed to the version in your workspace
    • Compare with Latest Version to see how your changes compare to the latest version of the file in your team's codebase

Use Solution Explorer or Source Control Explorer to view what you changed

  1. Locate and select the item in Solution Explorer or in Source Control Explorer.
  2. Open the context menu for the item, and then choose Compare.
  3. On the Compare dialog box, from the Type menu, choose:
    • Workspace Version to see what you've changed in the version in your workspace
    • Latest Version to see how your changes compare to the latest version of the file in your team's codebase
    • One of the other options: Changeset, Date, or Label.
  4. Choose OK.

The Diff window appears. See Compare files.

Undo your pending changes

You can discard one, a few, or all of the pending changes in your workspace.

Note

A few other options:

To undo a few of your pending changes

  1. In Solution Explorer, the Pending Changes Window, or Source Control Explorer, select one or more items, open their context menu and choose Undo or Undo Pending Changes.

    Tip

    To undo all changes you have made in your solution or a code project, open the context menu, and then choose Undo Pending Change.

  2. In the Undo Pending Changes dialog box, make sure the changes you want to undo are selected, and then choose Undo Changes.

To undo all your pending changes

  • On the Pending Changes page, choose the Actions link, and then choose Undo All.

Use the command prompt

  • Status command : Display pending changes in the command prompt.

  • Checkin command : View pending changes in the Check In dialog box.

  • Undo command : Undo pending changes.

    Tip

    You can use this command to undo another user's check-out if you have sufficient permissions.

  • Difference Command : See what you have changed in a file.

Next steps

When you're ready:

Tips