views:

648

answers:

4

What is the concept of each?

When is it ok to shelve your changes instead of checking in?

+8  A: 

Shelved means the changes are set aside for you to work on later.

Checked in means that the changes are made available to the rest of the team, will be in the build and will eventually ship.

Very different. Think of shelving as a tool for context switching when you're not done with a task. Checking in means you're done (at least a part of it).

Darcy Casselman
+2  A: 

Shelve your changes when you want to save the changes that you have made, but need to go back to the previous version to make other changes (perhaps, bug fixes) that you want to deploy without the updates you are currently working on. Since you're usually checking in pretty regularly, I find this to be a rare occurence -- like I just deployed to the QA box and an error was immediately found. I'll shelve that day's changes bringing me back to the QA deployed version, make the update, then unshelve my changes -- merging the two as necessary. Any longer than that and you'll probably be looking to check out a previous version and branch instead. I'd be happy to hear of other experiences where shelving has proved more useful, though.

tvanfosson
+1  A: 

Darcy gets it spot on. You can also think of shelving as a private branch that is not publicly visible for the most part. Shelvesets can also be deleted completely, not like deleting checked in code. If you delete a shelfset it is gone forever.

Ray Booysen
A: 

Other users can download your shelvesets by searching for them, so it is a good way to pass code around for reviews. however you will get an error if you try to unshelve code files that you already have checked out, so you need a clean environment ready.

I often shelve my changes at the end of the day if I'm working on something big that I can't check in. That way, if my PC dies overnight, I've got a backup on the server.

ck