Below is a simple explanation of TFS branching and merging for one branch and one merge.
Branching
- Make sure you have all files check in or shelved
- Open Visual Studio 2010 Team Explorer panel
- Open your project > Source Control
- Make sure your folder structure is like this:
- BuildProcessTemplates
- Main
- All your project source code
- If your source code is not in this folder structure above then:
- Create a Main folder
- Right-click individually on each folder/file and select Move and choose Main as the destination (Can’t multi-select and move for some reason)
- Your history will be kept
- Check in all your changes
- Now right-click on the Main folder and select Branching and Merging > Branch
- Now in Target Branch Name type the name of your branch e.g. FeatureBranch1
- Click OK (keep default checkbox selections)
- Wait until branching has completed and then check in all changes
You will now have a Main branch e.g. C:\Dev\Project\Main, and a FeatureBranch1 branch e.g. C:\Dev\Project\FeatureBranch1. So open the FeatureBranch1 solution and make all your branch changes there. Then when you ready you can merge this branch into Main.
As I rule we should label our check-ins for:
- The main like this Project: Then the check in description e.g. Puma: Fixed menu layout
- The branch like this Project\FeatureBranch1: Then the check in description e.g. Puma\FeatureBranch1: New regions implemented
Merging
- Make sure you have all files check in or shelved
- Open Visual Studio 2010 Team Explorer panel
- Open your project > Source Control
- Get latest on the Main branch
- Now right-click on the branch folder e.g. FeatureBranch1 and select Branching and Merging > Merge
- Source branch should be FeatureBranch1 and Target branch should be Main – Click Next
- Version type should be Latest Version – Click Next
- Click Finished
- The merge will now occur and bring up any conflicts - Resolve the conflicts (easier said than done)
- Check in the merge when you confident it works
Shane
No comments:
Post a Comment