Rome
Node.js
Group

git flow, a successful git branching model - Dec 23 2011
Luca Lanziani - @_Nss_

git flow

a successful git branching model. [1]
via http://nvie.com/

Concept


Improve productivity and maintainability keeping our Git repositories nice and tidy.

Essence

(just) a branching strategy and release management

me

Main branches

master and develop may be synced with the origin.

origin/master
always reflects a production-ready state.
origin/develop
always reflects latest delivered development changes for the next release.

Support branches



feature branches
hotfix branches
release branches

Flow

Feature

$ git checkout -b myfeature develop
//Switched to a new branch "myfeature"

commit changes...

$ git checkout develop
//Switched to branch 'develop'
$ git merge --no-ff myfeature
//Updating ea1b82a..05e9557
$ git branch -d myfeature
//Deleted branch myfeature (was 05e9557).
$ git push origin develop

Feature

Hotfix

$ git checkout -b hotfix-1.2.1 master

bump the version...

$ git commit -a -m "bumped version number to 1.2.1"
$ 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
$ git branch -d hotfix-1.2.1

Hotfix

Release

$ git checkout -b release-1.2 develop

bump the version...

$ 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
$ git merge --no-ff release-1.2
$ git branch -d release-1.2

Release

Flow

confusing?

should I be master?

NO, we have a surprise

gitflow is a tool [2]

released in github by nvie

Have it

OSX
$ brew install git-flow
//or
$ port install git-flow
Linux
$ wget --no-check-certificate -q -O \
- https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | \
sudo bash
Windows
Really?? Ok https://github.com/nvie/gitflow/wiki/Windows

Init it

Init a repo:
$ git flow init
output:
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master] 
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? []

Enjoy it (feature)


Start a feature:
$ git flow feature start myfeature

End a feature:
$ git flow feature finish myfeature

Enjoy it (hotfix)


Start an hotfix:
$ git flow hotfix start hotfix-1.2.1

End an hotfix:
$ git flow feature finish hotfix-1.2.1

Enjoy it (release)


Start a release:
$ git flow release start release-1.2

End a release:
$ git flow feature finish release-1.2

Enjoy it (life is easy)

The End

Thanks for watching

Refs


Sources:

[1] http://nvie.com/posts/a-successful-git-branching-model/
[2] https://github.com/nvie/gitflow


Moar: http://yakiloo.com/getting-started-git-flow/
Images from: http://octodex.github.com/