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?
Shelving has many uses. The main ones are:
Any other uses?
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
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.
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.
I come across this all the time, so supplemental information regarding branches:
If you're working with multiple branches, shelvesets are tied to the specific branch in which you created them. So, if you let a changeset rust on the shelf for too long and have to unshelve to a different branch, then you have to do that with the July release of the power tools.
tfpt unshelve /migrate
@JaredPar: Yes you can use Shelvesets for reviews but keep in mind that shelvesets can be overwritten by yourself/others and therefore are not long term stable. Therefore for regulatory relevant reviews you should never use a Shelveset as base but rather a checkin (Changeset). For an informal review it is ok but not for a formal (E.g. FTA relevant) review!
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.