Show Menu

A succesful Git Branching Model (nvie) Cheat Sheet (DRAFT) by

"A succesful branching model" is a blog post written by nvie. This cheat sheet shows the commands to be used.

This is a draft cheat sheet. It is a work in progress and is not finished yet.


Only final releases
Current state of code. Release branch may branch of this one
A release branch. Tagged at creation with version number. Branches of develop once. No new features after branch off
Only for important bug fixes. Branches of master, tagged at creation
Many may exist. Branch of and merge to develop.

Release Branch

Creating release branch
checkout release 1.2 from develop
git checkout -b releas­e-1.2 develop
Bump version to 1.2
./bum-­ver­ 1.2
git commit -a -m "­Bumped version number to 1.2"
Finishing release branch
Checkout master
git checkout master
git merge --no-ff releas­e-1.2
tag version (may use -s or -u to sign tag crypto­gra­phi­cally)
git tag -a 1.2
Merge back to develop as well
git checkout develop
git merge --no-ff releas­e-1.2
delete release branch
git branch -d releas­e-1.2
May branch of develop
Merges into develop and master
Naming conven­tion: release-*

Feature Branch

git checkout -b myfeature develop
incorp­orate finished feature
Checkout develop
git checkout develop
Merge feature (no-ff forces new commit)
git merge --no-ff myfeature
Delete feature branch
git branch -d myfeature
Push develop
git push origin develop
Branches of and merges into develop.
Name anything except master, develop, release- or hotfix-

Hotfix branches

Creating Hotfix Branch
checkout from master
git checkout -b hotfix­-1.2.1 master
Bump version
./bump­-ve­rsi­ 1.2.1
git commit -a -m "­Bumped version number to 1.2.1"
Now fix bug
Commit bugfix
git commit -m "­Fixed severe production proble­m"
Finishing a hotfix branch
git checkout master
git merge --no-ff hotfix­-1.2.1
git tag -a 1.2.1
Include fix in develop
git checkout develop
git merge --no-ff hotfix­-1.2.1
Delete temporary branch
git branch -d hotfix­-1.2.1
May branch of master
Merges into master and develop
Naming conven­tion: hotfix-*