You already use git, and you heard about the git workflow, but you never used it before ? Here is a short explanation. You can read a more complete explanation here

Workflow: Pros & Cons

“elegant mental model that is easy to comprehend and allows team members to develop a shared understanding of the branching and releasing processes” nvie, father of this workflow

Pros:

Cons:

When to use it

All the time, except if you are alone on your project.
If you are alone (probably on some side-project) then this workflow may slow you down, but it is still a good practise.

Summary

global schema

Explanations: master VS develop

The central repo, usually refered to as origin, holds two main branches:

When the code in the origin/develop branch reaches a stable point and is ready to be released,
we merge it into origin/master with a release number

global schema

Explanations: Temporary branches

  1. Release
  2. Hotfix
  3. Feature

1. Release branches

WHY

Preparation of a new production release.
minor bug fixes & preparing meta-data for a release (version number, build dates, …)

NAMES

release-*

REPOS

origin repo

CODE
git checkout -b release-1.2 develop

It is exactly at the start of a release branch that the upcoming release gets assigned a version number—not any earlier. Up until that moment, the develop branch reflected changes for the “next release”

./bump-version.sh 1.2
git commit -a -m "Bumped version number to 1.2"
git checkout master
git merge --no-ff release-1.2
git tag -a 1.2
git checkout develop
Switched to branch 'develop'
git merge --no-ff release-1.2

Possible action on release branches:
This new branch may exist there for a while. During that time, bug fixes may be applied in this branch (rather than on the develop branch).
But adding large new features here is strictly prohibited (They must be merged into develop).

2. Hotfix branches

WHY

Fix immediatly a critical bug in a production version

NAMES

hotfix-*

REPOS

origin repo

CODE
git checkout -b hotfix-1.2.1 master
./bump-version.sh 1.2.1
git commit -a -m "Bumped version number to 1.2.1"
git commit -m "Fixed severe production problem"
git checkout master
git merge --no-ff hotfix-1.2.1
git tag -a 1.2.1
git checkout develop
git merge --no-ff hotfix-1.2.1

One exception: when a release branch currently exists, the hotfix changes need to be merged into that release branch, instead of develop.

3. Feature branches

WHY

Develop new features

NAMES

anything except master, develop, release-*, or hotfix-*

REPOS

the developer repo

CODE
git checkout -b myfeature develop
git checkout develop
git merge --no-ff myfeature
git branch -d myfeature
git push origin develop

Note about –no-ff:
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

It is important when you have to revert a whole feature (= a group of commits). It is a true headache without the –no-ff! see this illustration:
noff

Reference: