Git Flow 代码示例
接触git flow也有很长一段时间了,中途偶尔用了一下,由于自己的手上的项目也不是大型项目,基本都是两三个人在做,master主要还是我自己,用git flow反而比较麻烦。也没有对这个原理进行深入理解。正好这段时间接手了一个项目,想试试git flow,然后就又了解了一下。git flow 的流程,可以用下面纯git命令来实现。
a. 创建develop分支
git branch develop
git push -u origin develop
b. 开始新Feature开发
git checkout -b feature1 develop
# Optionally, push branch to origin:
git push -u origin feature1
# 做一些改动
git status
git add some-file
git commit
c. 完成Feature
git pull origin develop
git checkout develop
git merge --no-ff feature1
git push origin develop
git branch -d feature1
# If you pushed branch to origin:
git push origin --delete feature1
d. 开始Relase
git checkout -b release-0.1.0 develop
# Optional: Bump version number, commit
# Prepare release, commit
e. 完成Release
git checkout master
git merge --no-ff release-0.1.0
git push
git checkout develop
git merge --no-ff release-0.1.0
git push
git branch -d release-0.1.0
# If you pushed branch to origin:
git push origin --delete release-0.1.0
git tag -a v0.1.0 master
git push --tags
f. 开始Hotfix
git checkout -b hotfix-0.1.1 master
### g. 完成Hotfix
git checkout master
git merge --no-ff hotfix-0.1.1
git push
git checkout develop
git merge --no-ff hotfix-0.1.1
git push
git branch -d hotfix-0.1.1
git tag -a v0.1.1 master
git push --tags
我的博客即将同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=3ckgexxns8g0o