Unshelving in TFS: What does it mean?

TfsShelveShelvingUnshelve

Tfs Problem Overview


Here's the part I get: When you shelve in TFS, it makes a server copy of the changes so they are not lost, but does not check them into the source code trunk/branch you are working on.

Question: Under what circumstances would you use the "unshelve" feature? Does it mean it will remove the shelveset from the TFS server? Can you do a get from a shelveset? Or is it really just a diff description between the shelveset and the "real" source code?

Tfs Solutions


Solution 1 - Tfs

Unshelving is how you restore the shelveset to your machine so you can keep working on it. It doesn't change the shelveset on the server (to do that you need to shelve things again and use the same shelveset name).

One example for how I use it is to move changes between machines while I'm working on them. I'll shelve it on my desktop machine, then unshelve it on the laptop and then continue working on the laptop.

You can also use it to share changes with someone (for code reviews or other reasons). You shelve your changes, then the other person can go and unshelve it to see what you've done.

Unshelving doesn't actually change the shelveset or anything else on the server. It's just a get operation.

Solution 2 - Tfs

Herms is spot on. Read his answer.

One important caveat: if you've done a Get since the shelveset was created, Unshelve will only rollback the local version of files contained in the shelveset. Thus, it's quite likely you'll have an inconsistent workspace.

A good practice is to always re-run Get after you Unshelve. This ensures you don't waste time on phantom build errors that are actually just side effects of being in a half-new/half-old state. It will also require you to resolve any conflicts between the shelveset contents and the latest server revisions proactively, instead of only discovering them @ Checkin time.

Solution 3 - Tfs

I use shelve to back up code-in-progress, just on the off chance my hard drive crashes or whatnot. I don't even have to worry about the code building, never mind working, since the work won't be seen by any other developers on my team (unless they go looking for it).

Unshelve pends the changes back in your workspace. Removing the shelveset from the server is a Delete.

Following on to what Richard Berg said, the power tools' version of unshelve actually includes a get and resolve.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbrentlightseyView Question on Stackoverflow
Solution 1 - TfsHermsView Answer on Stackoverflow
Solution 2 - TfsRichard BergView Answer on Stackoverflow
Solution 3 - TfsstanniusView Answer on Stackoverflow