Source Control Shelving and Unshelving
Shelving is very powerful feature of the Source Control in VSTS that allows storing pending changes without checking them into Source Control. This is useful when we are working on changes but not able to finish them up before required check in process. We simply shelve these changes for the time being. When we are ready to proceed with further development, we can unshelve those files and safely complete our work that can be checked into the source control at the end of the day. There are many other reasons you may consider shelving files:
- Interruption of your work
- Integration of all files
- Code Reviews
- Backup process
- Handoffs
When we shelve file or files, we can provide comments and other meta data. All these data is stored inside our Source Control and is called shelveset. Shelvset is a non-versioned unlike changeset and as a result, any new shelvset that is created will completely replace existing shelvset. You can also delete shelvset from the Source Control. Other limitations of shelvsets are: cannot link to a work item and bypass any check-in policies.
Shelving folder of files can be done in several ways. We can shelve pending changes via Source Control Explorer, Solution Explorer, Pending Window changes or command line. We’ll examine most common way of doing it in more details which is Solution Explorer shelving.
In order to shelve pending changes, we need to have file checked out with any changes done to it. We need right-click on it and select “Shelve Pending Changes”.
The next window prompts us confirm files being shelved.
Confirm Shelved
The next windows asks us to provide shelvset name and comments as well as choice of deselecting files from shelving if not required.
Shelve Files
Unshelving is very similar to shelving. All we need is to select from “File” menu item called “Source Control” and then click “Unshelve”.
Unshelve File
Pressing on Unshelve button will initiate process or retrieving file from the Source Control and Checking out all files affected by this Unshleving for editing.