GitHub Branching Strategy


I would be using Gitflow branching model as starting point. This is a common strategy used by enterprises but should be reviewed in future to find a flexible and collaborative way of sharing code in a consistent manner depending on the team’s size and requirements.

How it works:

This workflow mainly uses two branches (“master” & “develop”) to record the history of the project.

  • master:is considered to be the main branch where the source code of HEAD always reflects a production-ready state. It’s also convenient to tag all commits in the master branch with a version number.
  • Develop: is considered 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. This is also called the “integration branch”

Screenshot 2020-03-18 at 12.20.20

When the source code in the develop branch reaches a stable point and is ready to be released, all of the changes should be merged back into master and tagged with a release number

Supporting Branches

Apart from the main branches master & develop, the following branches can be used to aid parallel development between team members based on the requirements.

  • feature
  • release
  • hotfix

Feature Branch

This branch is used to develop any new features for the upcoming or a distant future release. The essence of the feature branch is that it exists as long as the feature is in development but will eventually be merged back into develop branch.


Release Branch

This branch is used to support preparation of a new production release.


Hotfix Branch

This branch is used to patch production releases. Hotfix branches are a lot like release and feature branches except they’re based on master instead of develop.


Basic Git Commands

Description Command
1 Clone a repo located at <repo_url>. git clone <repo_url>
2 Fetch/pull the changes from remote git pull
3 Stage all changes in <path> for the next commit. git add <path>
4 Commit the staged snapshot git commit -m “”
5 List which files are staged, unstaged, and untracked. git status
6 Show the difference/changes between your index and working directory. git diff
7 Upload/push local repo changes to remote git push
8 Create a new branch git checkout -b <branch name>
9 Switch to an existing branch git checkout <branch name>
10 List branches git branch     (list local branch)
git branch -r (all remote branches)
11 Create tag git tag <tag>
12 List tags git tag
13 Push tags git push –tags