Create new TFS branch with history

2019-07-28 11:49发布

问题:

I need to branch out, but I also need to keep the history so I can remove some change sets and build a new project. I tried branching in the UI and that created a new branch with only one history item indicating that this was branched from so and so.

回答1:

The newly created branch still contains all the history nested inside the new changeset. You can only view the history of the individual files, not with the folder or the branch.

You must click "view history" on a file in the new branch then click the drop down arrow on the branch creation changeset and the old history will show up.

For your situation, you can just branch with changeset instead of with the latest version. Detailed steps below:



回答2:

Assuming you are on TVFC rather than Git here. It doesn't really work like that, the branch isn't a clone of the complete source and history. It's kind of a marker to say we are now diverging the code base, there will be a shared history for the two branches.

When you branch you can choose to do it at the latest version, a label, a date or a changeset. Can you branch at the changeset that you want? And then you are free to build and edit in isolation in the new branch.

You can also get a specific version to your local workspace so you might not even need a branch if you only want to build a certain version of the code.