1
2
3
4
5
6
7
|
$ git checkout -b hotfix-1.2.1 master Switched to a new branch "hotfix-1.2.1" $ ./bump-version.sh 1.2.1 Files modified successfully, version bumped to 1.2.1. $ git commit -a -m "Bumped version number to 1.2.1" [hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1 1 files changed, 1 insertions(+), 1 deletions(-) |
分支关闭的时侯不要忘了更新版本号(bump the version)
然后,修复bug,一次提交或者多次分开提交。
1
2
3
|
$ git commit -m "Fixed severe production problem" [hotfix-1.2.1 abbe5d6] Fixed severe production problem 5 files changed, 32 insertions(+), 17 deletions(-) |
完成一个hotfix分支
完成一个bugfix之后,需要把butfix合并到master和develop分支去,这样就可以保证修复的这个bug也包含到下一个发行版中。这一点和完成release分支很相似。
首先,更新master并对release打上tag:
1
2
3
4
5
6
|
$ git checkout master Switched to branch 'master' $ git merge --no-ff hotfix-1.2.1 Merge made by recursive. (Summary of changes) $ git tag -a 1.2.1 |
编辑:你可能也会想使用 -sor-u 参数来对你的tag进行加密
下一步,把bugfix添加到develop分支中:
1
2
3
4
5
|
$ git checkout develop Switched to branch 'develop' $ git merge --no-ff hotfix-1.2.1 Merge made by recursive. (Summary of changes) |
原文转自:http://blog.jobbole.com/34706/