We are using git-flow for our source code branch management model. If you are not familiar with git-flow, Why aren’t you using git-flow? article provides a nice overview.

Many git users may be familiar with the git merge vs git rebase debate. In essence:

  1. Merge is simple to use and works great. It creates however lots of merge commits especially when working with a larger team.
  2. Rebase keeps commit history linear and clean. It is however harder to use and can be potentially destructive.

git merge vs git rebase: Avoiding Rebase Hell article provides a great comparison of both techniques.

The way to get the best of both worlds is to be explicit about when to use one versus the other. For us the simple rules to follow are:

  1. Rebase feature branches.
  2. Never rebase develop or master branch. (Always merge into develop and master.)
  3. Never rebase public branches.

To implement the rules we made a small change to the standard git-flow process:

When implementing enhancements or fixes always start by creating a feature branch:

git flow feature start foo

When done with work:

  1. pull develop branch from github
  2. rebase feature branch on top of develop

    git rebase develop feature/foo
  3. finish feature branch

    git flow feature finish foo
  4. push develop to github

To get more details on using rebase with feature branches please go to The magical (and not harmful) rebase article.

With this simple process change, git commit history is easier to follow while risks of making a mistake are kept at bay.