Git Flow流程示例代码
1,创建develop分支
#从master拉出develop分支
#可选,获取最新版本。git pull origin master
git checkout -b develop master
#发布develop分支
git push -u origin develop
2,创建feature分支
#从develop拉出feature_v1.0功能分支
#可选,获取最新版本。git pull origin develop
git checkout -b feature_v1.0 develop
#发布feature_v1.0分支
git push -u origin feature_v1.0
#在feature_v1.0上开发一些功能
3,完成feature,合并到develop分支
#develop分支获取最新
git pull origin develop
#切换到develop分支
git checkout develop
#从feature分支合并到develop分支
git merge --no-ff feature_v1.0
#删除feature分支,也可以不删除
git branch -d feature_v1.0
4,开始release
#从develop拉出一个release分支
#可选,获取最新版本。git pull origin develop
git checkout -b release_v1.0 develop
#fix bugs
5,完成release,合并到master分支和develop分支,在master打上tag标记
#合并到master
git checkout master
git merge --no-ff release_v1.0
#在master打tag标记
git tag release1.0 master
git push --tags
#合并到develop
git checkout develop
git merge --no-ff release_v1.0
6,开始hotfix
#从主线master拉出一个hotfix分支
#可选,获取最新版本。git pull origin master
git checkout -b hotfix_v1.0.1 master
7,完成hotfix,合并到master和develop,并在master上打tag。
#合并hotfix_v1.0.1到master
git checkout master
git merge --no-ff hotfix_v1.0.1
#在master打上tag
git tag hotfix1.0.1 master
git push --tags
#合并hotfix_v1.0.1到develop
git checkout develop
git merge --no-ff hotfix_v1.0.1