Is shelving in TFS merely a soft checkin so other team members can see the source code?
i.e. the shelved code will not be compiled right?
One point that is missed in a lot of these discussions is how you revert back on the SAME machine on which you shelved your changes. Perhaps obvious to most, but wasn't to me. I believe you perform an Undo Pending Changes - is that right?
I understand the process to be as follows:
So, if you want to start some work which you may need to Shelve, make sure you check-in before you start, as the check-in point is where you'll return to when doing the Undo Pending Changes step above.
Shelving is a way of saving all of the changes on your box without checking in. The changes are persisted on the server. At any later time you or any of your team-mates can "unshelve" them back onto any one of your machines.
It's also great for review purposes. On my team for a check in we shelve up our changes and send out an email with the change description and name of the changeset. People on the team can then view the changeset and give feedback.
FYI: The best way to review a shelveset is with the following command
tfpt review /shelveset:shelvesetName;userName
tfpt is a part of the Team Foundation Power Tools
If you're using Gated builds, when a build is triggered, it creates a shelveset of your workspace that is submitted for build. If the build fails, the shelveset is rejected. If the build is successful, a changeset is created and committed to TFS. In either event, the person doing that check-in/build will have to reconcile the workspace, which is as simple as performing a Get Latest.
Shelving is like your changes have been stored in the source control without affecting the existing changes. Means if you check in a file in source control it will modify the existing file but shelving is like storing your changes in source control but without modifying the actual changes.
Shelving has many uses. The main ones are:
Any other uses?
That's right. If you create a shelf, other people doing a get latest won't see your code.
It puts your code changes onto the server, which is probably better backed up than your work PC.
It enables you to pick up your changes on another machine, should you feel the urge to work from home.
Others can see your shelves (though I think this may be optional) so they can review your code prior to a check-in.