Branche Strategies, Source Code!

Abdulmohsen Alenazi
4 min readJun 8, 2021

--

How do you manage branches? What you should do to enable the best practices.

Everywhere has challenges! to enable DevOps!

What is the difference between managing releases and enabling DevOps?

Most of companies are adopting some form of DevOps and configuration management philosophy. They will be automating their pipelines, in order to get rid of production supports and down times!, Some companies get the goal, for example, Netflix. but this isn’t an easy goal to achieve.

Release Engineering,

When you’ve big team working on new releases in the same project and most of them see the light and others not, how to manage these branches/features!?

DevOps,

It is a big topic, but the main goal is to achieve the pipelines and automation deployment.

To follow will be information about GIT/Branches

What is the best Git Branch Strategy?

Git and other version control systems give software developers the power to trace, manage and organize their source code.

Git helps developers collaborate on code with teammates; combining powerful features like commits and branches with specific principles and strategies helps teams organize code and reduce the time needed to manage versioning.

Of course, every developer and development team are different, with unique needs. Here is where a Git branching strategy comes in.

We will be covering three fairly popular Git branch strategies, each with their own benefits. The best part? None of these workflows are set in stone and can, and should, be modified to fit your specific environment and needs.

Please note: many of these original strategies refer to ‘main branches, but we have chosen to use ‘master instead.

Git Flow Branch Strategy:

The main idea behind the Git flow branching strategy is to isolate your work into different types of branches. There are five different branch types in total, they’re mostly used :

  • Master
  • Develop
  • Feature
  • Release
  • Hotfix

The two primary branches in Git flow are master and develop. There are three types of supporting branches with different intended purposes: feature, release, and hotfix.

Branching in Git:

In Git, there are common misconceptions about branching. For example, some assume that a branch is a group of commits, or that a branch must diverge in the Git graph.

In fact, a branch is simply a pointer to one specific commit.

The branch pointer moves along with each new commit you make, and only diverges in the graph if a commit is made on a common ancestor commit.

The branching model offered by Git is lightweight compared to other version control systems, and helps protect you from merging unstable code into the master code base and gives you the chance to clean up your history before merging into the master branch.

Git flow and its problems:

Git flow was one of the first proposals to use Git branches, and it has received a lot of attention. It suggests a master branch and a separate develop branch, as well as supporting branches for features, releases, and hotfixes. The development happens on the develop branch, moves to a release branch, and is finally merged into the master branch.

Git flow is a well-defined standard, but its complexity introduces two problems. The first problem is that developers must use the develop branch and not master. master is reserved for code that is released to production. It is a convention to call your default branch master and to mostly branch from and merge to this. Because most tools automatically use the master branch as the default, it is annoying to have to switch to another branch.

The second problem of Git flow is the complexity introduced by the hotfix and release branches. These branches can be a good idea for some organizations but are overkill for the vast majority of them. Nowadays, most organizations practice continuous delivery, which means that your default branch can be deployed. Continuous delivery removes the need for hotfix and release branches, including all the ceremony they introduce. An example of this ceremony is the merging back of release branches. Though specialized tools do exist to solve this, they require documentation and add complexity. Frequently, developers make mistakes such as merging changes only into master and not into the develop branch. The reason for these errors is that Git flow is too complicated for most use cases. For example, many projects do releases but don’t need to do hotfixes.

Git Flow: Pros & Cons:

The Git flow branching strategy comes with many benefits but does introduce a few challenges.

The Benefits of Git Flow:

  • The various types of branches make it easy and intuitive to organize your work.
  • The systematic development process allows for efficient testing.
  • The use of release branches allows you to easily and continuously support multiple versions of production code.

The Challenges of Git Flow:

  • Depending on the complexity of the product, the Git flow model could overcomplicate and slow the development process and release cycle.
  • Because of the long development cycle, Git flow is historically not able to support Continuous Delivery or Continuous Integration.

--

--

Abdulmohsen Alenazi
Abdulmohsen Alenazi

Written by Abdulmohsen Alenazi

Software Developer / Architect. Coding first 🙌🏻 GitHub: https://github.com/mohsenTalal

No responses yet