Baseless Merging of different branches of your srouce code

The process of merging items that are not directly branched from each other is called a baseless merge. For example:


you might want to merge a change between two release branches (Iteration 1 and Iteration 2), which are siblings of each other, without merging up to the parent branch (Main). You can only perform a baseless merge by using the Tf mergecommand. In Visual Studio 2010 and prior, you cannot perform a baseless merge from within the Visual Studio IDE. But in Visual Studio 2012, this feature (Baseless merge) is integrated with VS IDE merge wizard. We will see this merge wizard in the last.

Just perform following 4 steps and merge your baseless branches.

  • Step 1 – Evaluate Whether a Baseless Merge Is Needed
  • Step 2 – Perform a Baseless Merge Using Tf.exe
  • Step 3 – Resolve Merge Conflicts
  • Step 4 – Check-In the Merged Changes

  • Before performing the merging, get latest code of both branches. Now open a Visual Studio command window, and run the following Tf.exe command from the command line:

    Tf merge /baseless <<source path>> <<target path>> /recursive 

    Example
    Tf merge /baseless e:\data\proj1 e:\data proj2 /recursive
    
    
    If you need to merge specific versions of the code changes, you can use the version switch with Tf.exe as follows:
    tf merge /baseless <<source path>> <<target path>> / recursive /version:<<from Changeset>>~<<to Changeset>>
    
    
    Example
    tf merge /baseless e:\data\proj1 e:\data\proj2 /recursive /version:C123~C125
    
    
    After executing the Tf command, you need to resolve conflicts that might occur when performing a baseless merge. After you run the Tf.exe command, it displays a Resolve Conflicts dialog box with a list of the files that have conflicts. After resolving the conflicts, you are now able to check in the changes and get the merged release.
    
    
    Visual Studio 2012 Baseless Merge Wizard 
    
    
    Right-click on the branch Iteration2 and select Merge option in Branching and Merging popup menu. Following popup window would be displayed.
    
    
    
    
    
    
    The Browse button at Target branch is new feature in Visual Studio 2012. Click on the Browse button and select and Target branch with which you want to merge the Iteration 2.
    
    
    
    
    
    
    
    
    Click Next and merge will be done as normal merging. Resolve the conflicts (if any) in the pending changes and check in the code.
    
    
    
    

    Comments

    Post a Comment

    Popular posts from this blog

    Data Bound Controls in ASP.Net - Part 4 (FormView and DetailsView controls)

    ASP.net: HttpHandlers

    The Clickjacking attack and X-Frame-Options