git flow Quick Start Guide

Our pilot study of using the git flow workflow and associated tools started with the art package. As a result of this trial, most multi-developer packages managed by the SSI group now use git flow.

Here are some quick tips to get you started.

Using git flow for the first time in a particular local repository.

  1. git clone ...
    cd <repo-dir>
    cd <repo-dir>
    git pull
  2. git flow init -d
  3. Occasionally, git flow init -d does not always set the "production release branch". This will occur, for example, if there are no commits on the master branch at the time you execute it. When this happens, run git flow init without the -d option. Specify the "Branch name for production releases" as "master" and accept the defaults for the remaining questions.
    git flow init
      Which branch should be used for bringing forth production releases?
         - develop
      Branch name for production releases: [] master
      Which branch should be used for integration of the "next release"?
         - develop
      Branch name for "next release" development: [develop] 
      How to name your supporting branch prefixes?
      Feature branches? [feature/] 
      Release branches? [release/] 
      Hotfix branches? [hotfix/] 
      Support branches? [support/] 
      Version tag prefix? []

To make the develop branch the current branch when the repo is cloned from Redmine (and for browsing the repository with Redmine) do the following as a manager after the master and develop branches created by your git flow init command have been pushed to Redmine with git push origin master develop:

ssh p-<project> "cd /cvs/projects/<repo> && git symbolic-ref HEAD refs/heads/develop"
N.B. With the current version of git in use by default on the Redmine git server (1.6.4), clones will continue to be initialized on the master branch until the two branches diverge (e.g. with a commit and push to the develop branch). When the git in use on the server is upgraded, this problem will be solved.

For particular development tasks.

  1. git flow feature start MyFeatureAddition
  2. Work ...
  3. commit as needed, but do not push
  4. If you need to fetch upstream changes:
    git fetch origin
    git rebase origin/develop
  5. Back to 2. until done.
  6. git flow feature finish
  7. git push origin develop

To publish a feature branch for collaboration purposes.

git flow feature publish <feature>

N.B. Once a feature has been published, git rebase should not be used: use git merge origin/develop instead.

To make a new release.

  1. git flow release start vx_yy_zz
  2. Work ...
  3. All code changes should already be made, this step is primarily to update the version (i.e. product_deps).
  4. Make sure you commit any changes before proceeding.
  5. git flow release finish vx_yy_zz
  6. git push origin develop master
  7. git push --tags

Set default checkout branch and redmine repository view to develop.

As a repository manager:

ssh p-<rep> "cd /cvs/projects/<rep> && git symbolic-ref HEAD refs/heads/develop"

Other resources.