whatwewant / whatwewant.github.io

2 stars 1 forks source link

[Git] 理解和遵守这样一个Git Flow Model #8

Open whatwewant opened 6 years ago

whatwewant commented 6 years ago

写在开始

Notes - A successful Git branching model

# 1 Feature Branches 执行过程

# 1.1 Creating a feature branch
# 1.1.1 切换到新分支myfeature
git checkout -b myfeature develop

# 1.2 Incorporating a finished feature on develop
# 1.2.1 切换到开发分支
git checkout develop
# 1.2.2 合并myfeature到develop, 使用 --no-ff
git merge --no-ff myfeature
# 1.2.3 删除myfeature分支
git branch -d myfeature
# 1.2.4 推送本地develop分支到远程
git push origin develop
# 2 Release Branches 执行过程

# 2.1 Creating a release branch
# 2.1.1 从develop创建新release分支
git checkout -b release-1.2 develop
# 2.1.2 更新verion number
./bump-version.sh 1.2
# 2.1.3 提交commit message
git commit -a -m "Bumped version number to 1.2"

# 2.2 Finishing a release branch

# 2.2.1 Merge into master
# 2.2.1.1 切换到master
git checkout master
# 2.2.1.2 合并relase-*到master
git merge --no-ff release-1.2
# 2.2.1.3 打标签
git tag -a 1.2

# 2.2.2 Merge into develop
# 2.2.2.1 切换到develop
git checkout develop
# 2.2.2.2 合并
git merge --no-ff release-1.2

# 2.3 Remove release branch
git branch -d release-1.2
# 3 Hotfix Branches 执行过程

# 3.1 Creating a hotfix branch
# 3.1.1 从master分支创建hotfix分支
git checkout -b hotfix-1.2.1 master
# 3.1.2 更新version number
./bump-version.sh 1.2.1
# 3.1.3 为version number添加commit message
git commit -a -m "Bumped version number to 1.2.1"

# 3.2 Now, it's time to fix the bug and commit the fix in one or more separate commits.
git commit -m 'Fixed severe production problem'

# 3.3 Finishing a hotfix branch

# 3.3.1 合并到Master
# 3.3.1.1 切换到Master
git checkout master
# 3.3.1.2 合并
git merge --no-ff hotfix-1.2.1
# 3.3.1.3 打标签
git tag -a 1.2.1

# 3.3.2 合并到Develop
# 3.3.2.1 切换到Develop
git checkout develop
# 3.3.2.2 合并
git merge --no-ff hotfix-1.2.1

# 3.4 删除hotfix分支
git branch -d hotfix-1.2.1