首页 Git Flow
文章
取消

Git Flow

git 版本控制系统(VCS)

git 版本号 (x.y.z)

  • X = 主版本号 (重大升级, 不同主版本的库之间是不兼容的)
  • Y = 次版本号 (增量升级,增加一些新的接口但保留原有接口.高版本号的库向后兼容低版本的库)
  • Z = 维护版本号 (仅修复 Bug) (修改错误,改进性能等,不添加新接口,也不更改接口.在主版本和次版本相同的前提下,不同维护版本之间完全兼容

Git Flow代码示例

a. 创建develop分支

1
2
git branch develop
git push -u origin develop

b. 开始新Feature开发

1
2
3
4
5
6
7
git checkout -b feature-some develop
# Optionally, push branch to origin:
git push -u origin feature-some    
# 做一些改动    
git status
git add some-file
git commit

GitFlow feature branches

c. 完成Feature

1
2
3
4
5
6
7
git pull origin develop
git checkout develop
git merge --no-ff feature-some
git push origin develop
git branch -d feature-some
# If you pushed branch to origin:
git push origin --delete feature-some

GitFlow develop branch

d. 开始Relase

1
2
3
git checkout -b release-1.1.0 develop
# Optional: Bump version number, commit
# Prepare release, commit

e. 完成Release

1
2
3
4
5
6
7
8
9
10
11
git checkout master
git merge --no-ff release-1.1.0
git push
git checkout develop
git merge --no-ff release-1.1.0
git push
git branch -d release-1.1.0
# If you pushed branch to origin:
git push origin --delete release-1.1.0   
git tag -a v1.1.0 master
git push --tags

GitFlow 发布分支

GitFlow 修补程序分支

f. 开始Hotfix

1
git checkout -b hotfix-1.0.1 master

g. 完成Hotfix

1
2
3
4
5
6
7
8
9
git checkout master
git merge --no-ff hotfix-1.0.1
git push
git checkout develop
git merge --no-ff hotfix-1.0.1
git push
git branch -d hotfix-1.0.1
git tag -a v1.0.1 master
git push --tags
本文由作者按照 CC BY 4.0 进行授权

gitlab 搭建

gtk 的使用