Gitflow assigned a clear role for the different branches, and define how and when to interact with each branch. There are historical branch, branch function, the release branch and maintenance branch.
History Branch
Use two branches to record the history of the project.
master branch records the history of the official release, and develop as an integrated branch branch function. Therefore, master branch of each submission should be assigned a version number.
Function branch
Function is branched out from the checkout develop the new branch, a branch corresponding to each function.
First, to ensure that the current project has develop development branch.
View current local branches:
$ git branch
b
bug
* develop
master
release
View all current branches:
$ git branch -a
b
bug
* develop
master
release
remotes/origin/develop
remotes/origin/master
remotes/origin/release
Remote with the words "remotes" is the remote branch
Creating a branch of ways:
$ git checkout -b 'develop'
Switched to a new branch 'develop'
1. Assuming a development feature:
git checkout -b feature-a develop
2. When a new function is completed, merged back into develop branch.
git checkout develop
git merge --no-ff feature-a
git push
git branch -d feature-a
Release Branches
1. When the need to develop the development branch release when pulled from the branch develop a release branch, named release- or Release / .
git checkout -b release-0.1 develop
2. The branch for publishing cycle, only bug fix for the release of the task, document generation and so on. The new features will not be added to this branch.
3. Once the release is complete, the release branch to merge the master branch.
git checkout master
git merge --no-ff release-0.1
git push
4. playing tag records the version number to facilitate tracking each release.
git tag -a 0.1 -m "release 0.1 publish" master
git push --tags
5. Place the changes made since the release branch merge to develop the new branch.
git checkout develop
git merge --no-ff release-0.1
git push
6. Finally delete a release branch
git branch -d release-0.1
Maintenance branch / hot fixes
When the online version appeared bug, you need to use to maintain the branch, which is used to quickly release version patch products.
1. From the master branch pull a maintenance branch (which is the only branch to pull out of the master branch).
git checkout -b hotfix master
2. After the repair is complete, immediately merged back into master and develop.
git checkout master
git merge --no-ff hotfix
git push
git checkout develop
git merge --no-ff hotfix
git push
git branch -d hotfix
3.master playing tag with the new version number.
git tag -a 0.2 -m "release 0.2 publish" master
git push --tags