Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Shelve and Unshelve Pending Changes

Shelving enables you to set aside the pending changes in your workspace to work on a higher priority task or to share your code with another user for code review.

Perform a Get Latest operation to synchronize your workspace with the latest server version. Then you need to build your application to ensure that it compiles before you shelve it or check it in. Doing so gives you an opportunity to incorporate changes to versioned files that have been made outside of your workspace.

Required Permissions

To unshelve a pending change, you must have the Read and the Check out permissions set to Allow. No permissions are required to perform the shelve task. For more information, see Team Foundation Server Permissions.

To shelve folders and files from Source Control Explorer

  1. In Source Control Explorer, right-click the file or folder, and then click Shelve Pending Changes.

  2. In the Shelve - Source Files dialog box, type the shelveset name, for example shelvetest in the Shelveset name box.

  3. The Shelve - Source Files dialog box includes two options:

    • Preserve pending change locally

      This option is selected by default. When this option is selected, the changes you made to the files or folders in your local workspace are preserved.

    • Evaluate Policies and check-in notes before shelving

      When this option is selected, all check-in policies are evaluated before the shelveset is created. For more information, see Working with Check-In Policies and Notes.

  4. In the Comment box, type Testing my shelveset, and then click Shelve.

    The files and folders are copied to the version control server and are available for other team members to unshelve.

To shelve folders and files from Solution Explorer

  1. In Solution Explorer, right-click, and then click Shelve Pending Changes.

  2. In the Shelve - Source Files dialog box, type the shelveset name, for example shelvetest in the Shelveset name box.

  3. The Shelve - Source Files dialog box includes two options:

    • Preserve pending change locally

      This option is selected by default. When this option is selected, the changes you made to the files or folders in your local workspace are preserved.

    • Evaluate Policies and check-in notes before shelving

      When this option is selected, all check-in policies are evaluated before the shelveset is created. For more information, see Working with Check-In Policies and Notes.

  4. In the Comment box, type Testing my shelveset and then click Shelve.

    The files and folders are copied to the version control server and are available for other team members to unshelve.

To shelve pending changes from the Pending Changes window

  1. In the Visual Studio integrated development environment (IDE), click View, click Other Windows, and then click Pending Changes Window, if not already open.

  2. In the Pending Changes window, click the Source Files icon, and then select the files you want to shelve.

  3. Click Work Items, and then add or remove work items. For each work item that you add, select either Resolve or Associate from the Check-in Action column.

  4. Select or clear the Preserve Pending Changes Locally or the Evaluate Policies and check-in notes before shelving box.

    NoteNote:

    Depending on the option you select, shelving either moves or copies a set of versioned file revisions, check-in notes, and a list of associated work items to a location that is outside the server. Therefore, it does not put you at risk of breaking the build inadvertently.

  5. Click Shelve.

  6. In the Shelve - Source Files dialog box, type a name in the Shelveset name box.

  7. Type a comment in the Comment box, and then click Shelve.

To shelve pending changes from the command line

  1. Click Start, click All Programs, point to Microsoft Visual Studio 2008, point to Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

  2. Type cd path, where path is the location of the directory used to store your personal copy of the files in the server (for example, c:\projects).

  3. Type tf.exe shelve shelvename and then press Enter.

    The Shelve - Source Files dialog box appears.

  4. The Shelve - Source Files dialog box includes two options:

    • Preserve pending change locally

      This option is selected by default. When this option is selected, the changes you made to the files or folders in your local workspace are preserved.

    • Evaluate Policies and check-in notes before shelving

      When this option is selected, all check-in policies are evaluated before the shelveset is created. For more information, see Working with Check-In Policies and Notes.

  5. In the Shelve - Source Files dialog box, select the files and folders to shelve, and then click OK to complete the shelve operation.

    NoteNote:

    For the full syntax available for the shelve command, see Shelve Command.

When you unshelve a shelveset, Team Foundation restores each shelved revision into 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 details about what happens during the unshelve process, see Working with Version Control Shelvesets.

The two most common reasons why you might want to unshelve a shelveset are:

  • No-touch code reviews (or workspace impersonation)

  • Integrate shelved pending changes into your work going forward

To unshelve a set of pending changes

  1. In Team Explorer, click File, point to Source Control, and then click Unshelve Pending Changes.

    The Unshelve dialog box appears.

  2. In the Owner name box, type the shelveset creator's name (for example, ADVENTUREWORKS\JuanGo or simply juango), and then click Find.

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

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

  5. As an option, deselect the Restore work items and check-in notes option if you do not want to have the work items and check-in notes associated with the shelveset restored.

  6. Select the shelveset or shelveset items you want to unshelve into your workspace, and then click Unshelve.

Unlike the Get operation, which merges reconcilable differences between two versions of a file automatically and helps you merge conflicts manually, the unshelve operation does not support merges. By removing shelved pending changes from your workspace at the commencement of the code review, you can be assured that any changes your reviewer makes to the shelveset, such as adding comments to a file, do not create merge conflicts during the unshelve process.

Unshelve can also be performed from the command line using the Unshelve Command.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft