Git Flow使用

git flow使用流程

1. 安裝git flow

windows: 提前安裝好 wget 和 util-linux

 wget -q -O - --no-check-certificate https://raw.github.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh install stable | bash

linux: apt-get install git-flow
mac: brew install git-flow-avh一般默認自帶

2. 初始化

對已有項目進行git flow 初始化

到項目目錄下執行命令:
前置條件需要, 本地需要有master分支和develop分支, 沒有就使用下面兩條命令進行創建分支
git checkout -b master origin/master
git checkout -b develop origin/develop
使用初始化命令:git flow init
如果不小心填錯, 就使用 git flow init -f 重新再來一遍

Ξ projects/leilanyu git:(develop) ▶ git flow init

Which branch should be used for bringing forth production releases?
   - develop
   - master
# 選擇你的產品分支
Branch name for production releases: [develop] master

Which branch should be used for integration of the "next release"?
   - develop
 # 選擇你的下一個版本的開發分支
Branch name for "next release" development: [develop] develop

# 下面全部默認
How to name your supporting branch prefixes?
Feature branches? [feature/] 
Bugfix branches? [bugfix/] 
Release branches? [release/] 
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? [] 
Hooks and filters directory? [/Users/zhan/bachang/cr/.git/hooks] 
Ξ projects/leilanyu git:(develop) ▶ 

3. 開發新功能

在項目目錄下面使用命令:git flow feature start you_new_feature
該命令會以 剛纔選的的develop分支爲基礎創建一個新的分支

Ξ projects/leilanyu git:(develop) ▶ git flow feature start my_train
Switched to a new branch 'feature/my_train'

Summary of actions:
- A new branch 'feature/my_train' was created, based on 'develop'
- You are now on branch 'feature/my_train'

Now, start committing on your feature. When done, use:

     git flow feature finish my_train

Ξ projects/leilanyu git:(feature/my_train) ▶ 

3.1 多人協作需要提交分支

如果是多人協作需要提交你剛剛創建的 feature/my_train分支到遠程分支 git flow feature publish my_train
然後使用普通git命令進行合併更新分支內容

4. 開發完成,刪除分支

git flow feature finish my_train

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章