Git flow 常用操作的对应的git命令

Posted on April 19, 2013

git flow feature start temp_feature

基于develop创建新分支,config不会有远程跟踪

git checkout -b temp_feature develop

git flow feature finish -F rm11_abc

-F,–[no]fetch: fetch from origin before performing finish (default: false) ??是fetch哪个?

git checkout develop
git remote update --prune
git pull origin develop                    更新本地develop到最新
git merge -no-ff feature/rm11_abc          把指定的本地分支合并到本地develop
git branch -d feature/rm11_abc             删除本地的指定分支,
git push origin :feature/rm11_abc          删除远程的该分支

git flow release start release010203

基于本地develop创建分支,无远程跟踪

git remote update --prune
git checkout -b release010203 develop

git flow release publish release010203

将本地分支推送到远程(作为远程的本地分支),remote下有记录,config下无追踪

git push origin feature/release010203

git flow release finish -F -p -m “release010203” release010203

-F fetch from $ORIGIN before performing finish -p push to $ORIGIN after performing finish -m use the given tag message

git checkout master
git fetch origin master                     更新master  fetch??
git merge –no-ff release010203              合并release到本地master
git tag -a release010203
git push origin master                      更新远程master
git checkout develop
git fetch origin develop                    更新develop fetch??
git merge –no-ff release010203              合并release到本地develop
git push origin develop                     更新远程develop
git commit -m "release010203"
git branch –d release010203                 删除本地release
git push origin :release010203              删除远程该release

git flow hotfix start hotfix010203

基于本地master创建分支

git remote update --prune
git checkout -b hotfix010203 master

git flow hotfix finish -F -p -m “hotfix010203” hotfix010203

本地和远程的master,develop都会被merge入这个hotfix。本地hotfix被删除(hotfix无需被publish)

  • Latest objects have been fetched from ‘origin’
  • Hotfix branch has been merged into ‘master’
  • The hotfix was tagged ‘hf_2’
  • Hotfix branch has been back-merged into ‘develop’
  • Hotfix branch ‘hotfix/hf_2’ has been deleted
  • ‘develop’, ‘master’ and tags have been pushed to ‘origin’