A review of Git branching strategies

Why you need a branching strategy?

Enhance developer productivity by ensuring proper coordination

Ensure parallel development

Organize a series of planned, structured releases

Establish a clear path for software changes through production

Ensure that developers are able to fix bugs quickly and get them back into production without disrupting their workflow

Strategies

Gitflow

Github Flow

Gitlab Flow

Trunk-based development

Everyone is working on the trunk (or master) directly

✅ avoid merge conflicts

Using short-lived branches - every day merge to master

✅ Continues integration is possible

✅ developers are able to see what other developers are doing without rebase or merges

❌ unstable master branch

The main or master branch is created firstly

Developers create feature branches which are merged back into the main/master branch and then they are deleted

githubflow

trunkflow

The development branch is used to integrate the team's work - features are merged there

An alternative to Github flow which support deployments on more than one environments

One branch per environment - deploy by merging code there

✅ Proper isolation between environments

✅ Different versions of software in different environments

The main/master can be used as stage environment