Peter Tirrell
Peter Tirrell

Reputation: 3003

How to branch/copy/move folder to different projects and keep history in TFS?

I have a folder underneath Project A that I would like to instead have under Project B, and I would like to retain the folder history once it is under Project B.

And, what I really want is to have the current state of Project A folder branched to a Dev branch under Project B, and then a snapshot through an older changeset of the Project A folder branched to a Main branch under Project B. For example:

$/TfsProjectA/MyProject --> branched to $/TfsProjectB/MyProject/Dev with full history and then since if I have the full history I could do $/TfsProjectB/MyProject/Dev --> branch to $/TfsProjectB/MyProject/Main based on a previous version of the now $/TfsProjectB/MyProject/Dev

Is something like this possible?

Upvotes: 3

Views: 5450

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

No, it's impossible.

Branching/move will lost the folder history , but the individual file history is actually not lost. It is hidden under the little "expand me" arrow at the far left on a file history line. Expand it on the oldest history entry for a file, or anywhere you see it, and you will see history of that individual file also from an old location that no longer exists.

However, merge the branch of changeset is based on the folder history. Such as the first changeset of $/TfsProjectB/MyProject/Dev will be changeset XXX branched from $/TfsProjectA/MyProject.

You will not be able to select the older changeset of $/TfsProjectA/MyProject


Solution

A way to achieve what your need is directly merge $/TfsProjectA/MyProject with old changeset to $/TfsProjectB/MyProject/Main Even though you will get a warning prompt as below:

A merge relationship does not exist between the source and the target. A baseless merge will be performed.

Upvotes: 3

Related Questions