Using branching to manage your project

Source: Internet
Author: User

The desire to enable parallel development is the primary reason that branching and merging was created. please development is a practice which enables development teams working on different areas of the same software project to work while minimizing the chance of changing es, thus minimizing wasted effort due to rework or defect retion. this is the method team Foundation server adopts for simplifying the concurrent development. but the main reason we are using branching and merging are keep the latest deliverable source during the development process, reduce the risk of impact for deliveries and simplify the project management.

What is branching and merging?

Team Foundation server defines branching as a feature that allows a collection of files to evolve in two or more divergent paths. branching is unique in that it's the only isolation mechanism that provides for collaboration amongst a group of people and versioning of changes within that isolated space. team Foundation server branches in "path space," which is analogous to copying a folder in Windows Explorer. however, unlike copying, branching maintains the history relating the source to the target to allow merging future changes.

Merging is the logical corollary to branching in team Foundation server. merging in version control is the process of combining changes that have transpired in two distinct branches. A Merge operation takes changes that have occurred in the source branch and integrates them into the target branch. merging integrates all types of changes in the source Branch including name changes, file edits, file additions, file deletions, and undeletions. the merge engine is able to do this because team Foundation server keeps a record of all changes including the relationships of a Child Branch to the parent branch. if items are modified in both the source and target branches, a version conflict will be filed and you will be prompted to resolve those conflicts. once you have created a branch, moving changes from the source branch to the target branch or from the target branch back to the source branch is very easy. team Foundation server maintains the relationships of branched items and the merge history.

Do you know how to merge branches?

In scrum, each Sprint has a short spective meeting at the end of the sprint, the product owner will decide if he accepts the sprint or decline. once a sprint has done and the product owner has accepted the sprint, You have to merge your source to the main trunk and branch a new repository for your new sprint. this work needs to be done before anyone starts coding on the new sprint. as the new sprint shocould use the new branch as the source control. there shoshould be no problems with this process and it shoshould take no longer than 30 minutes.

1. merge from "$/[client]/[project]/dev/main" into "$ [client]/[project]/dev/[sprint]".

This step merge the changes from main branch into the latest sprint. you must choose to merge the latest version of main branch but not any Changeset. the merge process collects all the necessary information especially the changes and the merge will be staged in your local workspace. that means it wont directly merge the changes on the server side but needs to perform a check-in operation to commit the changes to the server. this gives you a chance to rollback the operation.

Right-click onMainBranch and select"Branching and merging... | Merge...".

In the first screenSource Control Merge Wizard, Make sure you chooseMainBranch as the source branch, and last sprint as the target branch.

We are going to merge with the latest version of the source. So, choose"Latest Version"In the version type (it's the default option ). 

ClickFinishButton to start the merge process.

There always shoshould be no changes if you don't have two sprints at the same time. as the main branch only contains the latest deliverable source and won't change until the current sprint are merged back to main branch.

2. merge from "$/[client]/[project]/dev/[sprint]" into "$ [client]/[project]/dev/main ". 

This merge is the big one. when you branch the new sprint from the main branch, then you committed all your deliveries to the new sprint repository. at the end of the sprint, all the tasks have been done, the changes need to be committed to the latest deliveries once the it has accepted by po. that means all the work in this sprint will be merged into main branch, it's a considerable changes which depends on the workload of this sprint.

Right-click onSprint 2Branch and select"Branching and merging... | Merge...". Make sure it's the opposite direction against the last step.Sprint 2Shocould be the source branch,MainIs the target branch, as we want to merge the changes from Sprint 2 back to main branch.

ClickNextButton to start the merge process. The merge process examines the changes between two branches, and put all the changes to main branch in your local workspace.

Once the merge process completes, you can see the changes from merge process inSource Control ExplorerWhich are flagged with"Merge, Branch".

  

3. Perform a file and contents diff between your local "main" folder and "$/[client]/[project]/dev/[sprint]" (this is a verification step)

Right click on the sprint name (here is sprint2), and selectCompareMenu.

In the folder difference Explorer below, you can see the summary information from the top section. "371 files compared: 0 different, 0 only on server, 36 only on local disk ". OK. you are ready to go! As there are no difference between server and local hosts t some extra files on the local, so you are ready to commit your changes to the main branch.

But what are those extra local files? In order to make sure you commit the accurate changes and don't miss any files, it's better to go through the list to see if there anything missing. in this case, all of them are local debugging files, so we are happy to keep them locally but not on the server.

4. Check in all merged changes on "$/[client]/[project]/dev/main"

In the last step, you have already merged all the changes back to main with your latest versions, but all the changes are staged on your local workspace. A check-in needs to be released med to commit all the changes to the main branch. right click on main, and select check in pending changes . we stronugly recommend you to put any comments for this check-in as this is a main change.

We also recommend you to use gated check-inMainBranch, this will shelve your changes to the server and do a team build with your changes. It only allows to check in the changes while team build completes successfully. ReferTeam build 2010-gated check-inFor more information about gated check-in.

5. Fix any problems with the integration.

Now you have already committed your changes and queued a new team build on the server. it shoshould be no problem to pass the team build and commit the changes, as the source committed to sprint 2 has already passed the team build. I wocould say yes in most cases. but sometimes, you still have to fix something in order to make the team build successfully. otherwise, your changes are still shelved but not committed.

6. Delete this branch 

The purpose of the deletion is to make sure it simplify your project management. if there are no concurrent sprint, it shoshould only have two branches that one is main which contains the latest deliverable source, and the other one is the current sprint. this brings you a simple view of the source control structure as well as neat view of the team queries when you connect with Visual Studio 2008. (the problem of connecting with Visual Studio 2008 is it doesn't show the queries as a tree view .)

Do the followings to delete the branch.

    1. Set all"SSW. sqldeploy_sprint2.xxx"Build definitions"Trigger | select one of the following check-in triggers"To"Manual"

    1. Delete all build instances
    2. Delete"$/SSW/sqldeploy/dev/sprint2"Branch
    3. Check-in.

Delete branch is not necessarily if your organization wants to keep the last sprint for a while. but it's a best practice to delete this sprint and then branch a new sprint from the main branch. the reason why we don't delete the build definitions for last sprint is we want reemploy them for the new branch.

Create a new branch.

Now, we are going to create a new branch for the new sprint, this will be the new repository for the new sprint which already contains all the latest deliverable source.

1. create a new branch from "$/[client]/[project]/dev/main" to "$/[client]/[project]/dev/[sprint]".

Right-click onMainBranch and select"Branching and merging... | Branch...".

InBranch from mainScreen, give a name ofTarget branch nameAnd then clickBranchButton to perform a branch from main.

 

2. Check in the new branch.

3. For each build Definition

  • Rename build defenition "SSW. sqldeploy _Sprint2. Xxx "to" SSW. sqldeploy _Sprint3. Xxx"
  • Change the build definitions"Workspace | working folders | source control folder"To point at the"$/SSW/sqldeploy/dev/sprint3"Folder
  • Change the build definitions"Process | 1. Required | items to build | projects to build"To"$/SSW/sqldeploy/dev/sprint3/SSW. sqldeploy. sln"
  • Change the build definitions"Process | 2. Basic | automated tests | 1. Test assembly | testsettings File"To"$/SSW/sqldeploy/dev/sprint3/traceandtestimpact. testsettings"
  • Test build

4. You are ready to go with the new sprint.

Notes: Hope this helps you understand branching and merging. Feel free to contact me if you find anything incorrect or unclear. forgiving me the bad English. Cheers!

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.