Git Branching Strategies — What Works and What Doesn’t

Simple Git Strategy

  • Master is what you have in your live environment. Always keep master as the branch that can be redeployed. You never know when you might need to redeploy to deploy to a different server. Keep this branch clean.
  • Create a branch from master when making any change. Even bug fixes. You can name them anything you want. Merge back into master when you deploy.

Github Flow

Git Flow

  • Master is what you have released. Master is your truth. Never commit directly to master.
  • Develop is you dev branch. It’s kind of like master for developers. This is the branch that you’ll use to create releases.
  • Create feature branches from the develop branch. You will merge back into the develop branch whenever you finish a feature or bug fix or whatever. Some people may even commit to the develop branch directly if they have small changes. It’s all okay because you build up the develop branch to create a release.
  • A release branch is created from the develop branch at any point of time you feel you have enough features for a release. This is what you’ll test and deploy before merging into master and develop again.
  • A hotfix branch can be created from the master branch. This is for when you have a bug on your release that can’t wait until your next release. You’ll merge this back into master and develop branches when finished.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store