在mac中使用git-flow

简介

工具git-flow是按照Vincent Driessen的branch 模型,实现的一个高层次(级别)的git仓库操作扩展集合。
在git-flow中,一切被划分为分支。 当你开始一个新特性的时候,你会基于develop分离出一个新的分支。 如果你在进行hotfix, 那么你是从master上分离的.
使用git-flow模型,在于明白每个分支是从哪个分支分离出来,最终应该合并到哪些分支去。

mac中安装

  1. 使用Homebrew安装
    brew install git-flow
  2. 使用MacPorts安装
    port install git-flow
  3. wget
    wget --no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo bash
  4. 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的一个提交。

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