Git Flow代码示例

  1. 创建develop分支
git branch develop
git push -u origin develop

  1. 开始新Feature开发
git checkout -b some-feature develop
# Optionally, push branch to origin:
git push -u origin feature-0.1.0
# 做一些改动    
git status
git add some-file
git commit -m "description"
  1. 完成Feature
git pull origin develop
git checkout develop
git merge --no-ff some-feature
git push origin develop
git branch -d some-feature
# If you pushed branch to origin:
git push origin --delete some-feature
  1. 开始Relase
git checkout -b release-0.1.0 develop
# Optional: Bump version number, commit
# Prepare release, commit

  1. 完成Release
git checkout master
git merge --no-ff release-0.1.0
git push
git checkout develop
git merge --no-ff release-0.1.0
git push
git branch -d release-0.1.0 // 删除本地分支
# If you pushed branch to origin:
git push origin --delete release-0.1.0   
git tag -a v0.1.0 master
git push --tags
  1. 开始Hotfix
创建并切换至hotfix分支
git checkout -b hotfix-0.1.1 master
  1. 完成Hotfix
合并到master分支
git pull
git checkout master
git merge --no-ff hotfix-0.1.1
git push

合并到develop分支
git checkout develop
git merge --no-ff hotfix-0.1.1
git push

删除本地分支
git branch -d hotfix-0.1.1

创建tag
git tag -a v0.1.1 -m 'version 1.4' master // 添加tag
git push --tags // 提交tag

你可能感兴趣的:(git,flow)