Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Software Development Branching Strategy-Git

Software Development Branching Strategy – Git

What a branch is?

A Branch is a copy of the original code sets which allows user to make changes without affecting the main code set. This philosophy can be compared to a tree structure. Master branch acts as a trunk of the tree from where the user can create the branch. It is always a component of the original repository. The rest of the users can continue working on branches created for them. Once the user completes the changes, working branches are merged back with the master branch/main code set. The master branch serves as an abstraction for the edit, stage or commit processes used for git operations.

Figure 1:What is a branch

Branches can isolate the team from important architectural changes like updating frameworks, common  libraries, etc. Master branch is created when user first commits a code using git command.

Why branching?

Branching, in the terms of revision controlling or SCM (Software Configuration Management), is the duplication of an object under revision control, so that modifications can take place in parallel. Because of Branching, team of developers will have easy way to collaborate inside one central codebase.

Version Control Systems (VCS) like git, creates a copy of codebase when developer creates a new branch. Any changes made in this new branch does not affect the codebase of main branch

Motivations for branching

Development in parallel is possible using branches, they also maintain multiple releases on different operating systems. Large projects uses branching strategy to fulfill multiple roles. e.g. fixes for bugs, new features, versions integration etc.

Branching Strategies

There are many branching strategies like branch per sub-team, branch per release, branch per feature or defect, etc. Usage of multiple branching strategies undoubtedly creates new opportunities to sustain or improve the performance of a team. User can solve complex problems in their environment using branching strategies.

Following are the few types of branching strategies

  • Release branching

This kind of branching strategy is used for open source or enterprise projects. A release branch is just a branch in the version control system, on which the code destined for particular release can be isolated from mainline development. The concept of release branches is certainly not constraint to the free software as many proprietary development organiations use them too. Release branches are considered as “best practices” in enterprise projects. It helps to stabilize main codebase when developers works on new code.They are very convenient in case of deadline issue of projects. They support preparation of a new production release. Release branch allows minor changes and preparing meta-data for a release.

Without release branches, the result is usually bad in several ways,

First, overall development momentum is slowed.

Second, the release is of poorer quality than it needed to be, because there were only a few people working on it.

Disadvantage of Release branch would be,

Release branches can be burdensome and hard to manage as many people are working on the same branch. If user must do a release branch, they should create the branch as close to the actual release as possible.

Figure 2:Release Branch

For e.g. From Master branch, Development Branch is created and from development branch release branches are created. As mentioned in the figure 2, the current version of the system is 1.0. In order to create a new release, user creates a new branch and performs changes on this branch. This branch is called as development branch. Once the development is completed, the release branch is created with version 1.1.

Release branch does not affect to the development branch. Once the release is rolled out, release branch is merged back with development branch. Before real release, release branch must merged back with master and development branch, so that there will be no bugs on development branch for future releases.

  • Feature branching

The purpose of feature branch is to allow developers to add certain feature in a code. Once the changes are done, the feature branch can be merged back with master branch.

The basic idea of a feature branch is that when users starts working on a feature, they take a branch of the repository to work on that feature. Feature branches lets the user concentrate on one task at a time.

The advantage of feature branching is that every developer can work on their own feature and can be isolated from changes made by other developers. They can pull in changes from the mainline at their own pace, ensuring they don’t break the flow of their feature. Furthermore, it allows the team to choose its features for release.

Disadvantages of feature branching:

Developers will run the main suite of tests before they check in, but no one is going to run the full suite of integration tests on every commit. Furthermore, setting up new builds regularly can be annoying and hence a user is unlikely to create a branch unless they are going to maintain a branch for a long time.

Figure 3:Feature Branch

For e.g. Master and development branch are parallel to each other. The developer creates a new feature branch from the development branch. After that he can switch from development branch to the newly created feature branch. Developer works on new features or task using feature branch. Feature branch is merged back with development and master branch after completing new feature or task.

  • Task branching

Task branch is a branch which a user creates to implement a given task. The purpose of task branching is to implement new  set of task or activities or bug fixes.

Most of the VCS uses the task-per-branching strategy. This has less to do with the fact that these systems can work in a distributed way and more to do with their actual ability to handle branching and merging correctly.

Task branching, also known as issue branching, directly connects those issues with the source code. Each issue is implemented on its own branch with the issue key included in the branch name. Using Task branching it is easy to apply specific changes to master or release branch.

Figure 4:Task Branch

For e.g. Version 1.3 is the current production release and it is having some bugs. The development branch is still unstable because of these bugs. In order to fix these bugs, we create a task branch and start working on that task. After completion of these tasks, changes are committed to the task branch and merged back to the master as well as development branch.

Conclusion

Branches provide isolated parallel development. They are also essential to maintain a previous release which is stable. Branching simplifies complicated workflows. Branches represents a single deliverable task from the organisation. Though branching is important part of development cycle, a user should not create a branch unless they have good reason to do so.

The post Software Development Branching Strategy-Git appeared first on DevOpsTech Solutions.



This post first appeared on Migrating XEN Virtual Machines To The AWS Cloud, please read the originial post: here

Share the post

Software Development Branching Strategy-Git

×

Subscribe to Migrating Xen Virtual Machines To The Aws Cloud

Get updates delivered right to your inbox!

Thank you for your subscription

×