简介
工具git-flow是按照Vincent Driessen的branch 模型,实现的一个高层次(级别)的git仓库操作扩展集合。
mac中安装
- 使用Homebrew安装
brew install git-flow
- 使用MacPorts安装
port install git-flow
- wget
wget --no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo bash
- curl
curl -L -O https://raw.github.com/nvie/gitflow/develop/contrib/gitflow-installer.sh
sudo bash gitflow-installer.sh
git-flow的branch模型
master分支:
总是发布稳定版本, 这反应了软件的最新/最稳定的状态develop 分支:
用于集成已完成的特性
用于集成来自针对master分支的hostfix
CIServer需要真对此分支进行日构建/运行测试/临时分支:
多人开发时可能需要在远程临时共享某些分支
使用
init
使用init命令来初始化一个新的repo,同时包括基本的branch结构。选项-d
会接受所有的缺省值。
git flow init [-d]
创建feature/release/hotfix/support分支
列出、开始、结束feature 分支
git flow feature git flow feature start <name> [<base>] #对feature分支,<base>参数必须是在develop上的提交 git flow feature finish <name>
push/pull feature分支
git flow feature publish <name> git flow feature pull <remote> <name>
列出、start/finish release分支
git flow release git flow release start <release> [<base>] # base 参数必须是develop分支的一个提交。 git flow release finish <release>
- 列出、start/finish hotfix分支
git flow hotfix
git flow hotfix start <release> [<base>]
git flow hotfix finish <release>
- 列出、start/finish support分支
git flow support
git flow support start <release> <base>
# 对support分支,<base>必须是master的一个提交。