Login

Log in with one your accounts

Contribution

We are happy you want to contribute to DXKB. Please choose your preferred way

All Articles
Oct 31, 20245 min read

Git Flow

Git Flow is a specific branching system for Git. It helps the team to better control and add different project versions. Learn how to use it!

What Is a Git Flow

Git Flow is one of many styles of Git workflows - a branching model set for Git. It is a huge framework for large projects and it can be utilized for your team’s needs. Git Flow describes the project’s release cycle and adds specific roles to different branches. It defines when and how are the branches interacting with each other. In this model, there are two types of branches: Master and Develop. Develop is an integration branch for features. Master stores the official release history. This branching design was published by Vincent Driessen in 2009 and became very popular ever since.

Git Flow branching modelSource: A successful Git branching model

The main branches:

  • Master branch stores the official release history. It contains an abridged version of your project. It is the core of the branching model with an infinite lifetime.
  • Develop branch is an integration branch for features. It contains the complete history of your project. It also has an infinite lifetime. When the code in this branch is stable and ready for a release, the changes are merged to the master branch and tagged with a release number.

Supporting branches:

  • Feature branches are created for each new feature. Their parent branch is the develop branch. Features should never interact directly with the master branch.
  • Release branch is created when there are enough features for a release. It enables one team to work on a current release while another team keeps working on features for the next release. Release branches’ parent is also the develop branch. This branch is where continuous delivery happens.
  • Hotfix branches are maintenance branches. They are created to quickly patch production release. These branches enable the team to fix mistakes without interrupting the workflow or waiting for the next release. Their parent is the master branch. Hotfix branches are the only branches to be forked directly off of the master branch. You can automatize the hotfix branch creation: whenever a mistake appears, the hotfix branch is automatically created.

Ready to put this knowledge into action?

Visit our website and learn how DX Heroes can help your business succeed.

Why You Might Want to Use the Git Flow

  • Git Flow Workflow simplifies parallel development because it isolates the new development from the released project. You can work on any project version. The new development is done in feature branches so it is merged back when the developer is satisfied with the code.
  • Your team can collaborate better and spends less time managing the project versions if they use simple and clear branching strategy, such as Git Flow Workflow.
  • You can always commit the changes and create a new feature branch when you need to interrupt your work. You can come back to your feature at any time.
  • Hotfix branches allow your team to make emergency changes. You do not have to worry that you would accidentally merge in a new development at the same time.

Problems the Git Flow Solves

How to Implement the Git Flow

There are lots of different applications that support Git Flow branching model and have specific feature settings for Git Flow (such as SourceTree, SmartGit or GitKraken). Pick the application suitable for your operation system to initialize the Git Flow.

Customize your project setup by following these steps:

  1. Start using git-flow by cloning an existing git repository.
  2. Create an empty develop branch to complement the default master branch. Push it to the server.
  3. Development of new features starts from the develop branch. Each feature resides in its own branch. Push the feature branches to the git repository for backup.
  4. Merge the feature branch back into develop branch when the feature is finished.
  5. Create a release branch when the features are ready for a release. The parent is the develop branch.
  6. Merge the release branch into the master branch and tag it with a version number. After that, it is merged back into the develop branch so the progress since the release is saved. The release branch will be deleted.
  7. If you need to make some critical changes, create a hotfix branch. Fork the branch directly off of the master branch. When you are finished with the changes, merge the hotfix branch to both master and develop branch (or the current release branch). Tag the master branch with an updated version number.

Common Pitfalls of the Git Flow

  • Not every team member uses Git Flow Workflow. It is crucial for smooth project development to ensure that all the team understands and uses the same workflow.
  • The Git Flow Workflow is customized for a specific product. The setting is too complicated for a new developer.
  • The team has too many features and is unable to finish them before the release. Development is drifting away from production.

Resources for the Git Flow

Was the article helpful?

Want to write for DXKB?

Feel free to contribute. People from DXKB community will be more than happy.

Contribution

We are happy you want to contribute to DXKB. Please choose your preferred way