Shelve and Unshelve Pending Changes (Team Explorer Everywhere)

You can use shelvesets to set aside the pending changes in your workspace to work on a higher-priority task or to allow another user to review your code.

First, you perform a Get Latest operation to synchronize your workspace with the most recent versions of the files on the server. Then you build your application to make sure that it compiles before you shelve it or check it in. If you take this approach, you can incorporate changes to versioned files that have been made outside your workspace.

In this topic

  • Shelve Pending Changes

  • Unshelve Pending Changes

Required Permissions

To unshelve a pending change, your Read and Check out permissions must be set to Allow. No permissions are required to perform the shelve task. For more information, see the following page on the Microsoft website: Team Foundation Server Permissions.

Shelve Pending Changes

You can shelve one or more pending changes from the Team Foundation Server plug-in for Eclipse or from the Cross-platform Command-Line Client for Team Foundation Server.

To shelve pending changes from the plug-in

  1. Open the Shelve dialog box by performing one of the following tasks:

    • In the Pending Changes window, click Shelve.

    • In Project Explorer or Package Explorer, right-click an Eclipse project, folder, or file that has pending changes, point to Team, and then click Shelve Pending Changes.

    • In Source Control Explorer, right-click an Eclipse project, folder, or file that has pending changes, and then click Shelve Pending Changes.

    The Shelve dialog box appears.

  2. In Shelveset name, type the shelveset name (for example, April 31, 2011 Code Review).

  3. In the Pending Changes list, review the list of files to verify that you want to include them in your shelveset. To exclude a file, clear its check box.

  4. (Optional) In Comment, type a comment that describes the shelveset.

  5. (Optional) If you are shelving files or other items that are associated with a work item, click the Work Items channel, and then select the check boxes for the work items with which the items are associated.

    You associate shelvesets much as you associate work items with changesets. For more information, see Associate Work Items with Changesets (Team Explorer Everywhere) and View Work Item Details from Pending Changes Window (Team Explorer Everywhere).

    Some organizations create check-in policies that require that you associate each check-in operation with at least one work item. If your organization has such a policy, you will be prompted if you have not selected the check box for a work item. For more information, see Associate Work Items with Changesets (Team Explorer Everywhere) and Setting and Enforcing Quality Gates (Team Explorer Everywhere).

  6. (Optional) Click the Check-in Notes channel, and add notes.

    Some organizations require that you provide notes from one or more roles. For example, your organization might require notes from a code reviewer, a security reviewer, and a performance reviewer. If your organization has such a policy, you will be prompted if you have not specified any required check-in notes. For more information, see Setting and Enforcing Quality Gates (Team Explorer Everywhere).

  7. (Optional) If you want to retain your pending changes on your local computer, verify that the Preserve pending changes locally check box is selected. Clear this check box if you want the pending changes to be reverted on your local computer after the shelveset is created.

  8. (Optional) If you want check-in policies and check-in note requirements to be applied to the shelveset, select the Evaluate policies and check-in notes check box.

  9. Click Shelve to create the shelveset.

To shelve pending changes at a command prompt

  1. At a command prompt, type tf shelve –comment:”Comment” ShelvesetName ItemSpec and then press ENTER.

    Replace Comment with an optional description of the shelveset. Replace ShelvesetName with the name of the shelveset that you want to create. Replace ItemSpec with the files or folders that you want to shelve. If you do not specify the ItemSpec parameter, all pending changes in the current workspace are shelved.

    For more information, see the following page on the Microsoft website: Shelve Command (Team Foundation Version Control)

    Note

    You can specify the –move option if you want the pending changes to be removed from your workspace after the files have been shelved.

  2. When prompted, confirm that you want to create the shelveset.

Unshelve Pending Changes

You can unshelve a shelveset from the Team Foundation Server plug-in for Eclipse or from the Cross-platform Command-Line Client for Team Foundation Server. When you unshelve a shelveset, Team Foundation restores each shelved revision to the destination workspace as a pending change as long as the revision does not conflict with a change that is already pending in the workspace. For more information about what occurs during the unshelve process, see Using Shelvesets to Set Aside Pending Changes (Team Explorer Everywhere).

Users usually unshelve code for the following reasons:

  • To retrieve code for a code review, after the shelveset was created to avoid checking in unreviewed code.

  • To integrate shelved pending changes into your work in the future.

You can use the Unshelve command to restore one, more than one, or all pending changes in a shelveset to your workspace. When you unshelve a shelveset, Visual Studio Team Foundation Server restores each shelved revision into the destination workspace as a pending change as long as the revision does not conflict with a change that was already pending in the workspace. Those pending changes appear in the Pending Changes window.

The Unshelve operation does not support merges, in contrast to the Get operation, which merges reconcilable differences between two versions of a file automatically and helps you merge conflicts manually. If you remove shelved pending changes from your workspace at the start of the code review, any changes that your reviewer makes to the shelveset, such as adding comments to a file, will not create merge conflicts during the unshelve process.

To unshelve pending changes from the plug-in

  1. In the Pending Changes window, click Unshelve.

    For more information about how to open the Pending Changes window, see View Pending Changes in Other Workspaces (Team Explorer Everywhere).

    The Unshelve dialog box appears.

  2. In Owner, type the alias of the user who created the shelveset (for example, ADVENTUREWORKS\JuanGo or just juango), and then click Find.

  3. In the Results list, click the shelveset that you want to unshelve into your workspace, and then click Details.

    The Shelveset Details dialog box appears.

    Note

    If you click Unshelve, you cannot verify whether you are retrieving the files that you intend. In addition, you cannot customize the behavior of the unshelve operation.

  4. In the Shelveset Details dialog box, clear the Preserve shelveset on server check box if you want to delete the shelveset from the server for Team Foundation version control.

  5. (Optional) Clear the Restore work items and check-in notes check box if you do not want to restore the work items and check-in notes that are associated with the shelveset.

  6. Select or clear the check boxes that correspond to the shelveset items that you want to unshelve into your workspace, and then click Unshelve.

    By default, all files in the shelveset are unshelved.

To unshelve pending changes at a command prompt

  • At a command prompt, type tf unshelve ShelvesetName, and then press ENTER. Replace ShelvesetName with the name of the shelveset that you want to unshelve.

    For more information, see the following page on the Microsoft website: Unshelve Command (Team Foundation Version Control).

See Also

Other Resources

View and Manage All Pending Changes in Your Workspace (Team Explorer Everywhere)

Submitting and Undoing Pending Changes (Team Explorer Everywhere)

Using Shelvesets to Set Aside Pending Changes (Team Explorer Everywhere)