Safely rename branch in TFS 2015 - tfs

I have a branch created in TFS 2015 that has a lot of work already done, but not yet checked-in. However, I need to rename the branch now, but I don't want to have to lose or reapply existing updates in order to do so.
Is there a way to safely change the branch name without losing any work?

Is there a reason you don't want to checkin before the rename? That sounds like the safest approach.
If not, I would create a shelveset as a backup before renaming. Then when you unshelve you might need to use the TFS Power Tools to do a tfpt unshelve /migrate.

Related

What is the easiest way to rename a shelveset in TFS?

I'm trying to rename a shelveset. The only way I can think of to do it is:
Unshelve it (uncheck Preserve shelveset on the server)
Gather all the changes into Included Changes (and exclude everything that wasn't part of that shelveset).
Re-shelve it with a different name
Is there an easier way?
(we are using TFS Version 15.117.26714.0)
What is the easiest way to rename a shelveset in TFS?
Personally think the method you think is the simplest or most direct.
Since TFS teams Suggested on their old user voice forum(Closed now):
Visual Studio Team (Product Team, Microsoft) responded · March 11,
2015 Thanks for the suggestion! We’re currently in the planning
process for enabling an iterative shelveset experience. We’ll update
this item when we have more details.
But so far, we do not have a very easiest way to rename a shelveset in TFS. And we do not have a "update shelveset" API in place:
Shelvesets
Do not have option to rename the name by the Shelve Command.
You could check this thread for some more details.
So, I agree with your idea is the easiest and most straightforward, and it is also the method I have used.

Compartilhar Shelve com outros Membros TFS

good morning, people!
A co-worker has made some changes to the project and now it is necessary to do the same so that I do my part now. However, he can not give a check-in because another team member "pulls" the latest version, it will pick up that part that no case could not, only I could remove those changes and after I do as the changes, yes do the standard check in.
This refeel a my doubt, should be something simple. And neither is it done the same for this not TFS. It's possible?
Your title is talking about how to share shelve with other TFS Members. There is a concert called Shelvesets in TFS. Shelvesets are useful when you want to stop work for:
Collaboration: You have pending changes that are not ready for check
in but you need to share them with another team member.
Other peoples could share their pending changes(haven't checked in) to you through shelveset. You could unshelve his shelveset which restores shelved file revisions, check-in notes, comments, and work item associations to the current workspace.
If you don't want the shelveset mess up your local work in VS, please also take a look at my reply here: Undo TFS Unshelve

View history with Visual Studio shelvesets

Is it possible to view history and compare with shelvesets? We are investigating the possibility of using shelvesets instead of check-ins. From our initial investigation it seems we cannot view history like we do for check-ins.
We are using Visual Studio 2010/TFS 2010.
From http://msdn.microsoft.com/en-us/library/ms181403(v=vs.90).aspx
Section: The Difference Between Changesets and Shelvesets:
Unlike a changeset, a shelveset is a non-versioned entity. If you or another user unshelve the items of which a shelveset consists, edit several files, and reshelve the shelveset, Team Foundation does not create a new version of the items for future comparison and maintains no record of who revised the items, when, or in what manner. The original shelveset is completely replaced.
So, no, you can't review history. I am unsure on methods of comparing shelvesets. You should also read that entire section (The Difference Between Changesets and Shelvesets) as each item in it is a strong argument to not use shelvesets in the place of changesets.
I also cannot think of any reason why using shelvesets instead of changesets would be desirable, maybe you can list the reasons why you all were exploring this path. Just think about not being able to track changes, that alone should be a deal breaker (of course, shelvesets not even being versioned should just about do it)..
Like it says on the link posted by dugas, shelvesets are built more for...well, shelving things. For example, on the project I am working on right now, I did a shelveset for some refactoring changes I was in the middle of because something unrelated broke and I needed the code back to the original non error-filled version. I also use it for when I'm in the middle of attempting something and want to have a backup but I don't want to check in code just yet.
There's no versioning on shelvesets, but it is possible to compare code in a workspace, to the code in a shelveset, without pulling the shelveset files.
Pull the versions of files you want to compare the shelveset contents to, into a workspace
open the solution in that workspace
File >> Source Control >> Unshelve Pending Changes...
find the desired shelveset and bring up its details
On each file in the Shelveset Details window, you can right-click and select Compare >> With Workspace Version...
TFS will pull the shelveset file to a temporary location, show the diff, and then (?) clean up the temp file after you're done.
You'll be comparing the shelveset file contents, to the contents of the files on the local disk in this workspace. If changes were made to both files, the compare won't be able to tell and will indicate all those changes. However, you can compare the selveset version to its original (Compare >> With Unmodified Version..), to see all the changes that were made just to the shelveset file. You can also find out the changeset that was the base for the shelveset file (Properties..), and see what changes were added to the workspace version since that common base changeset.
There's no tree compare though, and this may require the TFS power tools to work.
P.S> I don't recomment trying to use shelvesets in place of checkins like this. If there's one thing I've learned over the years, it's not to fight Microsoft's designed-in workflows -- you do things their way, or you find a different tool. Microsoft doesn't intend you to use shelvesets this way (they want you to use changesets and a branch), and if you try, you'll constantly be fighting Microsoft's designed-in workflow.
You can use shelvesets for peer code-review before committing them to the repository ... and also for parking commits before going through a gated build process.
They are not suitable for anything other than "quick shelving" of work - use branching if you want to have multiple parallel work streams.

Orphan a branch in TFS

Suppose I create an experimental branch in TFS. Now, I am finished with the branch, and I want to keep it around, but it has diverged sufficiently from the source branch that I want to make sure that no one can merge it back on accident. Is there a command in TFS to sever a branch, so that there is no merge path back?
I'm not sure if this will prevent a merge but in TFS 2010 you can turn a branch in to a folder
Check out Buck Hodges blog on the subject
As far as I know, you can set permissions on a branch.

Can a branch be made from a previous changeset?

I need to create a branch at a specific Changeset in TFS. Is this doable?
For example, I have changeset 1528 that was the last check in on my project. But I want to branch from changeset 1487. Can this be done?
If so, how?
Note: I am using TFS 2008
Yes. When a branch is created you can choose the historical point in time when it takes effect (date, changeset, etc).
See Visual Studio TFS Branching and Merging Guide for some great information on recommended branching practices.
Or How to: Branch Files and Folders (MSDN) for more explicit instructions on getting this dialog up to create a branch.
Visual Studio 2010 and later added support for this functionality:

Resources