GitFlow工作流
GitFlow.png
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