GitFlow工作流
Git常用命令
- 创建开发分支
git branch develop
git push -u origin develop
git clone ssh://user@host/path/to/repo.git
git checkout -b develop origin/develop
- 开始开发新功能
git checkout -b some-feature develop
git status
git add
git commit
- 完成功能开发
git pull origin develop
git checkout develop
git merge some-feature
git push
git branch -d some-feature
- 准备发布
git checkout -b release-0.1 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
- 用户发现bug
git checkout -b issue-#001 master
#Fix the bug
git checkout master
git merge issue-#001
git push
就像发布分支,维护分支中新加这些重要修改需要包含到develop
分支中。然后就可以安全地删除这个分支了
git checkout develop
git merge issue-#001
git push
git branch -d issue-#001