Git Workflow

Git Workflow

 

Reference:

 

Main Branches

Branch Name Description
master Master to be the main branch where the source code of HEAD always reflects a production-ready state
develop Develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release.

Supporting Branches

Branch Name Description
feature-[feature_name] Feature branches are used to develop new features for the upcoming or a distant future release.
release-[release#] Release branches support preparation of a new production release.
hotfix-[hotfix#] Hotfix branches are used for when a critical bug in a production version must be resolved immediately. Hotfix branches may be branched off from the corresponding tag on the master branch that marks the production version

Feature Branch Workflow

  • May branch off from: develop
  • Must merge back into: develop and master
  • Branch naming convention: feature-[feature_name]

Create a new feature branch from develop

  1. Write Tests
  2. Write Code
  3. Test Code
  4. Commit Code

Merge feature branch into develop

The –no-ff flag causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward. This avoids losing information about the historical existence of a feature branch and groups together all commits that together added the feature.

Release Branch Workflow

  • May branch off from: develop
  • Must merge back into: develop and master
  • Branch naming convention: release-[release#]
  • No new features added! Only bug fixes allowed.

Create a new release branch from develop

  1. Write Tests
  2. Write Code
  3. Test Code
  4. Commit Code

Merge release branch into master and create a tag

Merge Bug Fixes made in release branch into develop branch

Delete Release Branch

Hotfix Branch Workflow

  • May branch off from:master
  • Must merge back into:develop and master
  • Branch naming convention:hotfix-[hotfix#]

Check a new hotfix branch from master

  1. Write Tests
  2. Write Code
  3. Test Code
  4. Commit Code

Merge hotfix branch into master and create new tag

Merge hotfix branch into to develop

Remove the temporary hotfix branch