Category : Source Control Guidelines
Shelving was introduced with the release of Team Foundation Server 2005 but there still seems to be a lot of confusion of how and when to use it. Shelving actually lets you set aside temporarily a group of pending changes together with pending check-in notes, a comment, and a list of associated work items. These modifications are stored on the Team Foundation Server but are not officially checked in into Source Control.
You may use this technique in the following scenarios:
- Shelve to backup pending changes
When you're working on a set of changes and at the end of the day you're not ready tho check-in, you may store those changes on the Team Foundation Server for backup purposes so you won't loose your work if something bad happens with your local development computer. You (or somebody else on your team) can pickup (unshelve) those changes later from any development computer.
- Shelve to review your pending changes
By shelving your work-in-progress code, you can invite others to review your code without checking in those changes in Source Control. This will prevent to check in unsafe code. You can also hand off partially finished work to another developer in your team.
- Shelve to switch your development context
In certain cases, you will be working on a feature with a lof of work-in-progress, while you need to switch urgently to another task that has higher priority. For this scenario, you can shelve all your pending changes to temporarily work on the high priority task. When you're done with the task you can unshelve your pending changes and get back to work on the feature. You won't have lost your work while you switched back to a stable version of the code.
Unshelving is the opposite of shelving and restores shelved file revisions, check-in notes, comments, and work item associations to the current workspace. 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 was already pending in the workspace.
Three ways to shelve/unshelve:
- From the pending changes window in Visual Studio
- From the context menu (right-click) in Visual Studio
- From the command-line
Labels: Team Foundation Server