Monday, April 4, 2016

A successful git branching model in Git command

http://nvie.com/posts/a-successful-git-branching-model/

(1) Develop a feature
// only branch from develop for features

git checkout -b myfeature develop

// merge back to develop no fast forward
// no ff=> merge has ci obj clear hist

git checkout develop
git merge --no-ff myfeature

// clean up

git branch -d myfeature
git push origin develop

(2) Release --always from develop, stay for a while
git checkout -b release-1.2 develop
./bump-version.sh 1.2
git commit -a -m "Bumped version number to 1.2"

(3) Release -- close up by merge

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

(4) Hotfix --always from master

git checkout -b hotfix-1.2.1 master
./bump-version.sh 1.2.1
git commit -a -m "Bumped version number to 1.2.1"
git commit -m "Fixed severe production problem"

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

No comments:

Post a Comment