Search code examples
tfstfvc

Merging 2 TFS branches with old code and new layout


in my TFS Source Control I have 2 solutions. The first one is the old version of a ASP.NET application, and the second is the same solution with a new graphic layout. The problem is that in the meantime, the solution N1 (Katalegale) has got new code functionality (no graphic modifications), and now I have to make a porting of these new only code addings to the solution N2 (Katalegale-Restyle), that has old code (code-behind in C#) but new graphic layout. How can I accomplish this?

Thanks a lot in advance.

Luis

Ps "Katalegale" has old graphic layout but new code. "Katalegale-Restyle" has new graphic layout but old code.

TFS Merging


Solution

  • In your situation, you just need to perform a merge. From source branch Katalegale to target branch Katalegale-Restyle.

    Merging allows to combines two different branches into one. Once more source branch and target branch are required and changes are incorporated from source branch into target branch.

    Merge detects files that were added or modified inside Source Branch and will add these changes or file into Target branch. If same files on the Target Branch were modified, then Conflict Resolution screen will pop-up with the opportunity to resolve the conflict.

    enter image description here

    In your case, you may have to manually resolve merge conflicts to make sure branch Katalegale-Restyle has new graphic layout and new code.

    Sample Steps:

    1. If you have any files checked out, either shelve or revert them. That way, if you need to revert the changes you won't lose anything else you were working on. You also won't pollute the merge with changes that aren't specific to it.
    2. Before doing anything, perform a Get Latest on the target branch Katalegale-Restyle. Next, right click on the Katalegalebranch, which is the source for the merge, and choose Branching and Merging > Merge from the context menu. You can either Merge all changes up to the latest branch or choose specific changesets. In your scenario, merge should happens with the latest version of the target repository.
    3. Click the Finish button and, if there are no conflicts, you should have a change set in your local work space that contains all of the changes since the branch was created. If there are any conflicts you will need to resolve each of those in turn before you are ready to commit the merge back into the Main branch. Add a nice commit message so that everyone knows that this is the result of a merge and job done.

    More details about merge and resolve conflicts, please refer our official doc: