Git flow Introduction

Post on 31-Aug-2014

1.760 views 1 download

Tags:

description

An introduction to Git Flow

Transcript of Git flow Introduction

Git Flow Introduction

David PaluyAugust 2012

Branches

A successful Git branching model

Master Branch

origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.

All of the changes should be merged back into master somehow and then tagged with a release number.

Develop Branch

origin/develop 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. Some would call this the “integration branch”. This is where any automatic nightly builds are built from.

Each time when changes are merged back into master, this is a new production release by definition.

Supporting branches

● Feature branches● Release branches● Hotfix branches

Feature branches

● May branch off from: develop● Must merge back into: develop● Branch naming convention: anything except

master, develop, release-*, or hotfix-*● Used to develop new features for the

upcoming or a distant future release

Release branches

● May branch off from: develop● Must merge back into: develop and master● Branch naming convention: release-*● Release branches support preparation of a

new production release. They allow for minor bug fixes and preparing meta-data for a release (version number, build dates, etc.)

● By doing all of this work on a release branch, the develop branch is cleared to receive features for the next big release.

Hotfix branches

● May branch off from: master

● Must merge back into: develop and master

● Branch naming convention: hotfix-*

Gitflow

A collection of Git extensions to provide high-level repository operations

https://github.com/nvie/gitflow

Initialize basic branch structure

git flow init [-d]

The -d flag will accept all defaults.

List / Start / Finish feature branches

git flow feature

git flow feature start <name>

git flow feature finish <name>

Push / Pull feature branches

git flow feature publish <name>

git flow feature pull <remote> <name>

List / Start / Finish release branches

git flow release

git flow release start <release>

git flow release finish <release>

List / Start / Finish hotfix branches

git flow hotfix

git flow hotfix start <release>

git flow hotfix finish <release>

Summary

Summary

It forms an elegant mental model that is easy to comprehend and allows team members to develop a shared understanding of the branching and releasing processes.