Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

《Git Flow 工作流》 #17

Open
wangsiyuan0215 opened this issue Sep 30, 2020 · 0 comments
Open

《Git Flow 工作流》 #17

wangsiyuan0215 opened this issue Sep 30, 2020 · 0 comments

Comments

@wangsiyuan0215
Copy link
Owner

先上图。

66A4B382-3BCE-4658-83A1-3A1C0BE5633A

295CDF5C-CAC9-4222-912A-0233C4DF1D16

1. 创建开发分支:

创建本地开发分支:

> git branch develop
> git push -u origin develop

其他开发人员需克隆中央仓库 master ,并在本地建立开发分支,追踪该分支:

> git clone ssh://user@host/path/to/repo.git
> git clone https://user@host/path/to/repo.git
> git checkout -b develop origin/develop

2. 开发新功能:

基于 develop 分支创建开发新功能 feature 分支:

> git checkout - b feature-some develop

然后进行正常开发:

> git add * | git add -A
> git commit -m "content of annotation"
> git push

新功能开发完成:

# 为了保证本地的 feature-some 和 develop 分支均是最新的
> git pull origin develop
# 切换 develop 分支
> git checkout develop
> git merge feature-some
> git push
> git branch -d feature-some

3. 准备发布:

使用新的分支进行发布准备工作:

> git checkout -b release-0.1 develop

这个分支是清理发布、执行所有测试、更新文档和其它为下个发布做准备操作的地方,像是一个专门用于改善发布的功能分支。

4. 完成发布:

一旦准备好了发布,合并修改到 master 和 develop 分支上:

> git checkout master
> git merge release-0.1
> git push

> git checkout develop
> git merge release-0.1
> git push

> git branch -d release-0.1

发布分支是作为功能开发(develop分支)和对外发布(master分支)间的缓冲。只要有合并到 master 分支,就应该打好 tag 以方便跟踪:

> git tag -a 0.1 -m "Initial public release" master
> git push --tags

5. 发现 Bug

基于 master 分支创建维护分支 hotfix,解决问题以后,合并回 master:

> git checkout -b hotfix-issue-#001 master

# fix bugs #

> git checkout master
> git merge hotfix-issue-#001
> git push

同发布分支相同,维护分支中新加的重要修改也要推到 develop 分支中:

> git checkout develop
> git merge issue-#001
> git push
> git branch -d issue-#001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant