Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Team Foundation
 How to: Shelve and Unshelve Pending...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Team System
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 and then build your application to ensure that it compiles prior to shelving or checking in. Doing so gives you an opportunity to incorporate changes to source 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, and 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. In the Comment box, type Testing my shelveset, and then click Shelve.

    The files and folders are copied to the source 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 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. In the Comment box, type Testing my shelveset and then click Shelve.

    The files and folders are copied to the source 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 2005 Team System integrated development environment (IDE), click View, Other Windows, and then click Pending Changes.

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

  3. Click Work Items, and then add or remove work items.

  4. Select or clear the Preserve Pending Changes Locally box.

    NoteNote

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

  5. Click Shelve.

  6. In the Shelve - Source Files dialog box and 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 2005, point to Visual Studio Tools, and then click Visual Studio 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.

  4. In the Shelve - Source Files dialog box, click OK to complete the shelve operation.

    NoteNote

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

Unshelving

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 Source 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.

You can use the unshelve command to restore individual file revisions from a shelveset to your workspace, but unshelving does not restore your entire workspace to the base workspace version, which is the server version upon which a shelved revision is based. After unshelving, perform one of the following operations to guard against the introduction of chronological inconsistencies in your code.

To unshelve a set of pending changes

  1. In Visual Studio 2005 Team System, click File, point to Source Control, and then click Unshelve.

  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. If you want to delete the shelveset from the Team Foundation source control server, deselect the Preserve shelveset on server option.

  5. Optionally 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. When the Details dialog box appears, 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.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Use two workspaces?      Grastveit   |   Edit   |   Show History
[Comment to the trick below] Can two workspaces on the same machine be used instead of two boxes?
Tags What's this?: Add a tag
Flag as ContentBug
The unshelve operation does not support merges      MemeDeveloper   |   Edit   |   Show History

Why not? This makes this whole feature pretty nightmarish to use with any reasonable sized project / number of changes. And branching in TFS.... let's just no go there pls.

I currently work around this using two boxes bound together with Synergy to share keyboard and mouse (excellent software btw and FREE - as in beer). Thought a description might help someone out so:

  1. I align the changes between them i.e. BoxA, BoxB and also TFS 100% (not as easy as it should be)
  2. Then I unshelve onto one BoxB, click check in (to allow the "Compare..." dialogue for all changed files from the shelveset) and manually go through on the other machine BoxA making the sensible "merged" / code reviewed changes we actually need.
  3. Then I (obviously rebuild, deploy BD projects etc, test)
  4. Check in on BoxA
  5. Undo all pending changes on BoxB (to revert it to the state before shelveset).
  6. Then I wait for any code gen, builds, tests etc on server, then pull down project from scratch onto BoxA.
  7. And once any teething issues sorted, then pull down onto BoxB and let the team know they can do the same.

This whole process is horribly time consuming, and I often have to resort to winmerge and notepad++ when the compare tool doesn't do the job.

Why compares can't be done against workspace items vs shelvesets is beyond me, I know the shelvesets are outside of the usual changeset DB and general flow, but can't see any reason a compare can't be done ! Winmerge can do it after all !

Anyhow, hope this info helps someone out.

Its the most efficient way I've found to deal with this sort of thing.Only made possible by two boxes and Synergy though.

And still get some strange TFS funkiness at times, just not half as much as with other methods I've tried in the past ;-)

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker