TFS-"Remove" code from another branch

Source: Internet
Author: User

This is in parallel development. due to incorrect merge/branch operations, branch B is mixed into branch a'sCodeBut branch B needs to be released to the production environment before Branch. This article records how to remove the Code introduced by branch a from branch B.

Problem description

Parallel development means that two different versions of the same project are under development at the same time. According to the normal process, each version should establish both the QA Branch and the dev branch from the main branch (production) for development without interfering with each other.

For example, versions A and B are derived from PRD and independent from each other. It is no problem to release any of them to the production environment first.

However, this process is not strictly followed in actual operations. At the beginning of B, A was nearly completed and has been transferred from Dev merge to QA. I made a mistake here, and directly developed Dev B from QA branch of Version A, so that Dev B is mixed into Dev a's code.

Unfortunately, the message is sent, and Version B needs to be released before version. This means that the code of a must be removed from B.

Solution

Here we need to do two things. One is to remove code A From Dev B and then submit it to QA and production according to the normal process. The other is because the code of A is removed, therefore, you need to submit the code of a again.

Manual code modification is obviously not feasible. Here we describe how to use TFs.

In the operation, "rollback" is used multiple times ). In the current TFs version, there is no separate "rollback" function, but it can be implemented in a roundabout way. For details, refer to the description on msdn. How to: Roll Back A Changeset

Remove Dev a code from Dev B
    1. Roll back the QA branch to the original version (QA 1) to form QA 3. This is to remove Dev a code from QA and get a "clean" version.
    2. Convert QA 3 merge to Dev B to form Dev B 3. This is to remove the code of Dev a From Dev B.
    3. Continue the development of B. After the development is complete, merge will go to QA to form QA 4, then merge will go to production and publish it to the product environment.

So far, B's development and deployment have been completed.

Re-submit the code of Dev a to QA

Because the code of Dev a has been removed from QA (qa2-> qa3), you need to submit it again. Can I submit Dev A3 merge directly to QA? After the attempt, the result is no effect, because Dev A3 has already passed merge to QA, and TFs will change Dev A1 ~ Dev A3 is marked as "submitted", so merge will not submit any changes later.

The final solution is to use two rollback operations, as shown below:

    1. Roll back the dev a branch to the original version (Dev A1) to form Dev A4.
    2. Run Dev A4 merge to QA.
    3. Roll back the dev a branch to the latest version (Dev A3) to form Dev A5.
    4. Run Dev A5 merge to QA. Task completed.

Note that the actual function here is to make version changes on Dev so that TFs can identify the changes and merge to QA. For example

Conflicts)

Rollback steps: 1. Get specified version; 2. Check out the entire folder; 3. handle conflicts; 4. Check in.

Rollback (Dev a3 => Dev a 4; Dev A4 => Dev A5; QA 2 => QA 3; Dev A4 => QA 5 ): take local is used for all conflicts, that is, earlier versions.

Other merge operations: automatic or manual merge operations. Changes to both branches must be included.

Digress: HTML5 canvas

The above version tree is drawn using HTML5 canvas.Source codeHere: tfsversiontree.rar

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.