Skip to content
Related Articles

Related Articles

Git Flow vs Github Flow

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 14 Jun, 2022
Improve Article
Save Article

There are basically two ways to manage the software projects in GIT Git flow and GitHub flow. These two flows can help you manage your project and optimize your entire workflow in the team.

GitHub Flow

GitHub flow is really very simple to adapt as this flow doesn’t have releases because your deployment to production happens every day. There are two types of branches involved in this flow, the master branch, and the feature branch.

GutHub Flow

  • When you are working on a project, you need to create a Feature branch out of your master branch and work on it.
  • Once you have developed a feature and tested the changes completely, Then you can create a pull request (PR) to the master branch.
  • Once the changes in the feature branch are reviewed and approved against the PR request, then the Branch is merged with the master branch.
  • Branches let you work on new features and fix bugs.

How to create a new Feature branch out of the master branch using checkout?

$ git checkout -b <branch-name>

For instance, You want to create a new branch ‘Feature’ from the ‘master’ branch. To achieve that, you have to call “git checkout” command with “-b” option and add the branch name as ‘Feature’

By using the ‘git checkout’ command you are creating a new branch and you are switching to the new branch automatically.

To explain the GitHub flow in simple steps, Refer to the below points:

  • You need to create a new branch out of the master branch when you want to develop a new feature or fix bugs.
  • Commit your changes to the feature branch locally and keep pushing your work on the same feature branch.
  • When you need help or feedback and you think you have developed the feature completely and your branch is ready for merging, then open a pull request(PR)
  • When someone has reviewed and approved the changes of the feature branch, you can merge it to the master.
  • Once it is merged and pushed to master, you can deploy it immediately.

Git Flow

Git Flow is usually more complicated than GitHub flow. It is used when your software has the concept of “release”. This flow works perfectly when you work in a team of one or more developers and they collaborate on the same feature.

Git Flow

Main Branches in Git Flow

  • Master: Represent the production-ready state of code
  • Develop: Represents the latest development changes

Feature Branch

Whenever one has to work on a new feature, they branch off from the develop branch, work on the changes in the feature branch. Once the changes in the feature branch are completed, request a Pull request to the develop branch. Once the feature is reviewed and approved, these changes can be merged back to the development branch.

Release Branch

  • Release branches are branched off from the Develop and merged back to develop and master.
  • You need to perform the bug fixing pre-released code in this branch, bug fixes may be continuously merged back to the develop branch.
  • All features targeted for release should be merged back to develop the branch
  • You should create a new release branch with a name that reflects the new version number.
  • If the release branch is to be released on the production server, then merge the release branch into the master, create a tag for future reference, then merge back changes to develop branch and then delete the release branch.

HotFix Branch

  • HotFix branches are branched off from the Master and merged back to develop and master.
  • Fix the bug in the hotfix branch, when finished with bug fixing, merge the hotfix branch with master then create Tag for future reference and Merge changes back to develop branch. Lastly, Delete hotfix Branch.

From a CI/CD perspective, we only want to deploy the develop and master branches respectively. Develop branch should be sent to dev or test environments. The master branch ends up in production environments.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!