Show Menu
Cheatography

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. http://nvie.com/posts/a-successful-git-branching-model/

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

Branches

master
Only final releases
develop
Current state of code. Release branch may branch of this one
Releas­e-x.x.xx
A release branch. Tagged at creation with version number. Branches of develop once. No new features after branch off
hotfixes
Only for important bug fixes. Branches of master, tagged at creation
Featur­e-f­eat­urename
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­-ve­rsi­on.sh 1.2
Commit
git commit -a -m "­Bumped version number to 1.2"
Fini­shing release branch
Checkout master
git checkout master
Merge
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: relea­se-*
 

Feature Branch

create
git checkout -b myfeature develop
inco­rporate 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, relea­se- or hotfix-

Hotfix branches

Creating Hotfix Branch
checkout from master
git checkout -b hotfix­-1.2.1 master
Bump version
./bum­p-v­ers­ion.sh 1.2.1
Commit
git commit -a -m "­Bumped version number to 1.2.1"
 
Now fix bug
Commit bugfix
git commit -m "­Fixed severe production proble­m"
Fini­shing 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-*