Git Flow vs Github Flow

Learn via video courses
Topics Covered

Overview

Two Git can manage software project flow, flows namely Git flow and GitHub Flow. These flows help in managing the software projects effectively and also optimize the flow.

Introduction

The Development cycles of large software projects are managed using different Git flows. The two main Git flows are Github flow and Git flow.

GitHub flow is used when there are no releases for the application and there is regular deployment to production.

when we compare Git flow vs GitHub flow Git flow is more complex than GitHub flow. It is mainly used when the software/application has the concept of the release. When more than one developer is working on the same feature then the Git flow is beneficial.

What is GitHub Flow?

GitHub flow does not have any concept of a release branch. There is mainly two types of branch involved in this flow namely master branch and feature branch.In GitHub flow, the hotfix is similar to a new feature which can be done by creating a hotfix branch and resolving the issue in the hotfix branch.

Process of Github flow

  • The master branch is the live working version of the application which runs on production.
  • To perform a new task, a new feature branch is created and the branch is named such that it specifies the work that is being done in that feature branch. For example, if the branch is creating a feature of "adding to cart" the branch can be named as add-to-cart-feature.
  • Code changes in the feature branch should be committed as frequently as possible locally and also should be synchronized to the branch with the same branch name on the server as frequently as possible.
  • If you want to merge your feature branch code to the master branch then a pull request should be initiated and request for code review.
  • When the code review is done the branch must be deployed on the test environment for testing of the feature.
  • If the code review and testing in the test environment are passed then the code should be deployed to production.
  • The latest package is created from the latest code in the master branch.

Process of Github flow

Pros of Github flow

  • Collaboration and flow are simple in GitHub flow.
  • Continuous integration and deployment process is set up.
  • GitHub flow helps in faster review so that the issues are resolved quickly if any.
  • The branching strategy in GitHub flow helps in easy debugging and managing technical issues.

Cons of Github flow

  • The speed in GitHub flow comes at the cost of comprehensiveness due to which sometimes it becomes difficult to manage the overall development flow.
  • The branching strategy help in a few ways but can also hamper the work for some team who want to make a large release and want to test multiple features together.
  • The master branch needs more attention as it is the development as well as the production branch. The developer should remain more attentive while pushing code to the master branch.

What is Git Flow?

Git flow is more complicated than GitHub flow. It is used when the application being developed has the concept of the release. Git flow addresses the need for parallel development i.e when more than one developer contributes to the same feature.

In Git flow a feature branch is created from the master branch whenever a new feature is built. When all the development work is done on this feature merge this branch code to the main code path for release.

The different types of branches used in Git flow are :

  • Feature branch - This branch is created for developing features by the developers.
  • Release branch - This branch handles the version release
  • Develop branch - This branch collects the developed feature from the feature branch.
  • Hotfix branch - This branch is used to resolve issues on a priority
  • Master branch - This branch stores the baseline of the latest release version.

What is Git Flow

Process of Git flow

  • For every feature, a respective feature branch is created and when the feature branch is completed, it is merged into the development branch. When a developer is working on more than one feature then the developer can switch from one feature branch to another by the checkout command.
  • When the feature branch is coded and tested in its respective feature branch then the code for that feature can be merged to the develop branch which has all the unreleased code of the features. The feature branch is mostly similar to the master branch but the develop branch contains unreleased code.
  • Once the develop branch is tested and verified then a release branch can be created from the develop branch for the next release.
  • If any issues occur in the release branch then it is resolved in the release branch and the changes done are also synchronized with the development and the master branches. So the master branch always keeps the baseline of the working version.
  • There is also a hotfix branch that is created when any defect occurs and it needs to be rectified on priority. Then a separate hotfix branch is created for that issue and once corrected the code change is synchronized to the develop branch and then to the master branch.

Pros of Git flow

  • Every branch has its separate responsibility that helps in a more organized flow.
  • It helps in large feature releases when more than one developer is working on the same feature.
  • Git flow has a very detailed version control system.
  • Development or Master branch is never frizzed for release preparation.
  • It has a flexible branching strategy in which it is easier to switch between development pipelines.
  • The code in the master branch remains up to date and contains the code that is thoroughly tested and verified.

Cons of Git flow

  • Due to the many types of branches sometimes it becomes difficult to understand Git flow.
  • The released versions require maintenance which increases the workload
  • The rigid workflow of Git flow creates conflict with the Agile methodology.

When is Git Flow Worth the Additional Complexity?

The additional complexity in Git flow can be useful in some situations:

  • When you have numbered version release (i.e version 1, version 2 types).
  • When many versions of the software need support and maintenance.
  • When you need to stop the work on one release feature and start working on another feature release and integration. For example, when one feature needs to be reviewed and tested for no bug fixes in the feature and integration is pending for the feature then also the development is still being continued on subsequent feature releases.

These are the cases which are when Git flow is worth the additional complexity.

Which Git Workflow is Appropriate for You?

If you are working on a single-release version and also the team size is not very big then Github below is the best option to select.

GitHub flow is not as complex as Git flow. GitHub flow provides a simple way of contributing and releasing through continuous deployment. Fixing bugs through a hotfix branch is also an easy process and works similarly to a feature branch.

Conclusion

  • GitHub flow is used when there are no releases for the application and there is regular deployment to production.
  • Master and Feature branches are the only two branches in GitHub flow.
  • When comparing git flow vs GitHub flow, Git flow is more complex than GitHub flow.
  • Git flow has branches such as Release branch, master, develop branch, hotfix branch, etc.
  • GitHub flow is used when there is no concept of release in the application and Git flow is used mainly for verification and testing of the release branch.