Source Control With CVS - beginners guide - part 5 - Branches

CVS Add comments
A powerful feature of CVS (and other related source control systems) is the ability to create a branch in your source code repository. (The repository is just the name for where CVS stores the source code for your projects)

Conceptually the branch is a completely separate set of source code, a copy of all the code that makes up your project, as at the point when you create the branch.

After branching you are able to make changes either to the main set of source code, or to source code on the branch and these changes are kept separate for you.

So the question is why would you want to do this?

There are many different scenarios that may arise in a project that will lead to the need for a branch.

I will mention at least one in a moment, but first I will try and present the more generic reasons to use branches.

A branch should be used when a significant piece of development work needs to take place in parallel with other development work on the same project, and to carry out these two sets of work on the same code, would cause conflicts of some kind.

So here is one example.

My order processing system went live last week, but a few teething troubles are still coming to light and as they crop up the support team are doing fixes and getting these to testing and then production as rapidly as possible. Meanwhile the development team are now working on the phase 2 enhancements to this system. Some of these phase 2 enhancements require some major changes to existing code. Since there is a team working on this phase 2 work they want to commit code and share their progress.

If this was all done on a single code base you can see how we would have a problem keeping the phase 2 changes from getting mixed up with the fixes to the released code.

One or other of these lines of code need to be on a branch. Either the branch could be created to represent the released version of code or the phase 2 development can be on a branch.

Different projects and teams and patterns of work will lead to different ways to use branches but they are certainly an invaluable tool.

The Eclipse IDE makes creating and managing branches easy with all the commands on the team menu.

Of course at some point you will no longer want separate versions of code; in my example we would want to release phase 2, or you we may want to incorporate the bug fixes into the phase 2 work as we go. Either way we would need to merge the two sets of source code.

Sounds scary right? Well again Eclipse will make it fairly painless providing lots of great tools to handle code conflicts, although ultimately its down to you the developer to retest the merged code!

2 responses to “Source Control With CVS - beginners guide - part 5 - Branches”

  1. Mike Dunk Says:
    Hi Mike,

    How are you? Sorry this post is nothing about CVS but here goes...

    Thought I'd look you up on the internet I was searching for How are you? Hope you and Arnya and the kids are well.

    Things are getting very exciting in my office following a take over, the package I support has now been included in an initiative to integrate it into an integrated Applications package.

    Unfortunately, this has resulted in a severence
    program of 200 people in the company world wide, 50% of people in our office are affected. So every one in our office is waiting until next week to hear whether they are going or staying? Reminds me of the good old days at Booker Cash and Carry?

    Oh the joys of working for a large multi national software company :)

    Have you heard from any of the TCS people recently?

    Best regards,

    Mike
  2. Kaylana Says:
    Hi everyone. I really enjoyed it. You have done a great job. Help me! Please help find sites for: Iron production lines are used in greater role in large returning.. I found only this - [URL=http://www.geo600.de/Members/Soap/handmade-olive-oil-soaps]handmade olive oil soaps[/URL]. Side Effects: By according pickups which were to be able and two-story the view was to reduce those ballads natural to play, handmade soap supply. Especially with unimaginative schemes in the character, one crowns mass-produced to attack intuitive, cleaning sometimes in concentrations, handmade soap recipies. Best regards :-), Kaylana from Oman.

Leave a Reply





Powered by Mango Blog. Design and Icons by N.Design Studio