Git flow Introduction

15
Git Flow Introduction David Paluy August 2012

description

An introduction to Git Flow

Transcript of Git flow Introduction

Page 1: Git flow Introduction

Git Flow Introduction

David PaluyAugust 2012

Page 2: Git flow Introduction

Branches

A successful Git branching model

Page 3: Git flow Introduction

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.

Page 4: Git flow Introduction

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.

Page 5: Git flow Introduction

Supporting branches

● Feature branches● Release branches● Hotfix branches

Page 6: Git flow Introduction

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

Page 7: Git flow Introduction

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.

Page 8: Git flow Introduction

Hotfix branches

● May branch off from: master

● Must merge back into: develop and master

● Branch naming convention: hotfix-*

Page 9: Git flow Introduction

Gitflow

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

https://github.com/nvie/gitflow

Page 10: Git flow Introduction

Initialize basic branch structure

git flow init [-d]

The -d flag will accept all defaults.

Page 11: Git flow Introduction

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>

Page 12: Git flow Introduction

List / Start / Finish release branches

git flow release

git flow release start <release>

git flow release finish <release>

Page 13: Git flow Introduction

List / Start / Finish hotfix branches

git flow hotfix

git flow hotfix start <release>

git flow hotfix finish <release>

Page 14: Git flow Introduction

Summary

Page 15: Git flow Introduction

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.