2013-03-14 07:38:44 +01:00
|
|
|
|
<!DOCTYPE html>
|
2014-02-14 17:55:08 +01:00
|
|
|
|
<html lang="zh-CN" xmlns="http://www.w3.org/1999/html">
|
2013-03-14 07:38:44 +01:00
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
|
|
<title>git-flow 备忘清单</title>
|
|
|
|
|
<link href='http://fonts.googleapis.com/css?family=Sansita+One' rel='stylesheet' type='text/css'>
|
|
|
|
|
<link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen,print">
|
|
|
|
|
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen,print">
|
|
|
|
|
|
|
|
|
|
<script src="js/jquery-1.7.2.min.js"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var _gaq = _gaq || [];
|
|
|
|
|
_gaq.push(['_setAccount', 'UA-33766650-1']);
|
|
|
|
|
_gaq.push(['_trackPageview']);
|
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
var ga = document.createElement('script');
|
|
|
|
|
ga.type = 'text/javascript';
|
|
|
|
|
ga.async = true;
|
|
|
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
|
|
|
var s = document.getElementsByTagName('script')[0];
|
|
|
|
|
s.parentNode.insertBefore(ga, s);
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2013-05-14 12:27:28 +02:00
|
|
|
|
<div id="banner"><a href="https://github.com/danielkummer/git-flow-cheatsheet">Fork me on GitHub</a></div>
|
2013-03-14 07:38:44 +01:00
|
|
|
|
<header>
|
|
|
|
|
|
|
|
|
|
<h1 id="title" style="font-size: 80px;">git-flow 备忘清单</h1>
|
|
|
|
|
|
|
|
|
|
<p id="author">
|
|
|
|
|
由 <a href="http://twitter.com/0r1g4m14dd1c7" target="_blank">Daniel Kummer (<a href="https://twitter.com/share" data-size="large">Tweet</a>)</a> 创建
|
2013-03-26 13:52:27 +01:00
|
|
|
|
|
2013-03-14 07:38:44 +01:00
|
|
|
|
</p>
|
|
|
|
|
<p id="desc">使用 git-flow 进行有效的分支实践。 by <a href="http://nvie.com/" target="_blank">Vincent Driessen</a></p>
|
2013-03-26 13:52:27 +01:00
|
|
|
|
<p id="translations">翻译:
|
|
|
|
|
<a href="index.html" title="english">English</a> -
|
2013-08-08 15:51:53 +02:00
|
|
|
|
<a href="index.es.html" title="spanish">Castellano</a> -
|
2013-03-26 13:52:27 +01:00
|
|
|
|
<a href="index.pt_BR.html" title="Brazilian Portugues">Brazilian Portugues</a> -
|
2014-07-18 17:15:17 +02:00
|
|
|
|
<a href="#" class="active" title="Simplified Chinese">简体中文(Simplified Chinese)</a>
|
2013-09-13 13:16:34 +02:00
|
|
|
|
<a href="index.ja_JP.html" title="日本語">日本語</a> -
|
2014-04-20 09:28:20 +02:00
|
|
|
|
<a href="index.tr_TR.html" title="Turkce">Türkçe</a> -
|
|
|
|
|
<a href="index.ko_KR.html" title="한국어">한국어(Korean)</a> -
|
|
|
|
|
<a href="index.fr_FR.html" title="Français">Français</a> -
|
2014-07-09 10:44:00 +02:00
|
|
|
|
<a href="index.it_IT.html" title="Italiano">Italiano</a> -
|
2014-07-18 17:15:17 +02:00
|
|
|
|
<a href="index.nl_NL.html" title="Nederlands">Nederlands</a> -
|
2014-07-09 10:44:00 +02:00
|
|
|
|
<a href="index.ru_RU.html" title="Russian">Русский (Russian)</a>
|
2013-03-26 13:52:27 +01:00
|
|
|
|
</p>
|
2013-03-14 07:38:44 +01:00
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2>关于</h2>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
git-flow 是一个 git 扩展集,按 Vincent Driessen 的分支模型提供高层次的库操作。
|
|
|
|
|
<small><a href="http://nvie.com/posts/a-successful-git-branching-model/">查看详情</a></small>
|
|
|
|
|
</p>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
|
|
|
|
|
<p>这个备忘清单展示了 git-flow 的基本操作和效果。</p>
|
|
|
|
|
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2>基础建议</h2>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>Git flow 提供了极出色的命令帮忙以及输出提示。请仔细阅读并观察发生了什么事情...</li>
|
|
|
|
|
<li>OSX 程序 <a href="http://www.sourcetreeapp.com/">Sourcetree</a> 是一个极出色的 git 界面客户端,已经提供了 git-flow 的支持。 </li>
|
|
|
|
|
<li>- Git-flow 是一个基于归并的解决方案,它并没有提供重置(rebase)特性分支的能力。</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="setup" href="#setup">安装</a></h2>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>你需要有一个可以工作的 git 作为前提。 </li>
|
|
|
|
|
<li>Git flow 可以工作在 OSX, Linux 和 Windows之下</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>OSX</h3>
|
2014-10-21 10:56:38 +02:00
|
|
|
|
<span>Homebrew</span>
|
2013-03-14 07:38:44 +01:00
|
|
|
|
<blockquote>
|
|
|
|
|
$ brew install git-flow
|
|
|
|
|
</blockquote>
|
2014-10-21 10:56:38 +02:00
|
|
|
|
<span>Macports</span>
|
|
|
|
|
<blockquote>
|
|
|
|
|
$ port install git-flow
|
|
|
|
|
</blockquote>
|
2013-03-14 07:38:44 +01:00
|
|
|
|
<h3>Linux</h3>
|
|
|
|
|
<blockquote>
|
|
|
|
|
$ apt-get install git-flow
|
|
|
|
|
</blockquote>
|
|
|
|
|
<h3>Windows (Cygwin)</h3>
|
|
|
|
|
<blockquote>
|
|
|
|
|
$ wget -q -O - --no-check-certificate
|
|
|
|
|
https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | bash
|
|
|
|
|
</blockquote>
|
|
|
|
|
<p>安装 git-flow, 你需要 wget 和 util-linux。</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<p>
|
|
|
|
|
更多的 git flow 安装指引,请阅读 <a href="https://github.com/nvie/gitflow/wiki/Windows" target="_blank">git flow wiki</a>.
|
|
|
|
|
</p>
|
|
|
|
|
<img src="img/download.png" alt="install git-flow"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="getting_started" href="#getting_started">开始</a></h2>
|
|
|
|
|
<p>为了自定义你的项目,Git flow 需要初始化过程。</p>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>初始化</h3>
|
|
|
|
|
|
|
|
|
|
<p>使用 git-flow,从初始化一个现有的 git 库内开始:</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow init
|
|
|
|
|
</blockquote>
|
|
|
|
|
<p>
|
|
|
|
|
你必须回答几个关于分支的命名约定的问题。<br/>建议使用默认值。
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="initialize"></div>
|
|
|
|
|
<div class="lines-small"></div>
|
|
|
|
|
<div class="lines-open"></div>
|
|
|
|
|
<div class="lines-big"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="features" href="#features">特性</a></h2>
|
|
|
|
|
|
|
|
|
|
<ul class="narrow">
|
|
|
|
|
<li>为即将发布的版本开发新功能特性。</li>
|
|
|
|
|
<li>这通常只存在开发者的库中。</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>增加新特性</h3>
|
|
|
|
|
<p>新特性的开发是基于 'develop' 分支的。</p>
|
|
|
|
|
<p>通过下面的命令开始开发新特性:</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow feature start MYFEATURE
|
|
|
|
|
</blockquote>
|
|
|
|
|
<p>这个操作创建了一个基于'develop'的特性分支,并切换到这个分支之下。</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="feature-start"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>完成新特性</h3>
|
|
|
|
|
|
|
|
|
|
<p>完成开发新特性。这个动作执行下面的操作.
|
|
|
|
|
</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>合并 MYFEATURE 分支到 'develop'</li>
|
|
|
|
|
<li>删除这个新特性分支</li>
|
|
|
|
|
<li>切换回 'develop' 分支</li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow feature finish MYFEATURE
|
|
|
|
|
</blockquote>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="feature-end"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>发布新特性</h3>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
你是否合作开发一项新特性?<br/>
|
2013-03-26 13:52:27 +01:00
|
|
|
|
发布新特性分支到远程服务器,所以,其它用户也可以使用这分支。
|
2013-03-14 07:38:44 +01:00
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow feature publish MYFEATURE
|
|
|
|
|
</blockquote>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="feature-publish"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>取得一个发布的新特性分支</h3>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
取得其它用户发布的新特性分支,并签出远程的变更。
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow feature pull MYFEATURE
|
|
|
|
|
</blockquote>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="feature-pull"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="release" href="#release">作一个release版本</a></h2>
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
<li>支持一个新的用于生产环境的发布版本。 </li>
|
|
|
|
|
<li>允许修正小问题,并为发布版本准备元数据。 </li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>开始准备release版本</h3>
|
|
|
|
|
|
|
|
|
|
<p>开始准备release版本,使用 git flow release 命令. </p>
|
|
|
|
|
它从 'develop' 分支开始创建一个 release 分支。
|
|
|
|
|
</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow release start RELEASE [BASE]
|
|
|
|
|
</blockquote>
|
|
|
|
|
<p> 你可以选择提供一个 <code>[BASE]</code>参数,即提交记录的 sha-1 hash 值,来开启动 release 分支. 这个提交记录的 sha-1 hash 值必须是'develop' 分支下的。</p>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
<p>创建 release 分支之后立即发布允许其它用户向这个 release 分支提交见容是个明智的做法。命令十分类似发布新特性:</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow release publish RELEASE
|
|
|
|
|
</blockquote>
|
|
|
|
|
<p>(你可以通过 <br/><code>git flow release track RELEASE</code> 命令签出 release 版本的远程变更)</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="release-start"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>完成 release 版本</h3>
|
|
|
|
|
|
|
|
|
|
<p>完成 release 版本是一个大 git 分支操作。它执行下面几个动作: </p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>归并 release 分支到 'master' 分支</li>
|
|
|
|
|
<li>用 release 分支名打 Tag</li>
|
|
|
|
|
<li>归并 release 分支到 'develop'</li>
|
|
|
|
|
<li>移除 release 分支</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow release finish RELEASE
|
|
|
|
|
</blockquote>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="release-end"></div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="hotfixes" href="#hotfixes">热点修复</a></h2>
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
<li>热点修复来自这样的需求:生产环境的版本处于一个不预期状态,需要立即修正。 </li>
|
|
|
|
|
<li> 有可能是需要修正 master 分支上某个 TAG 标记的生产版本。 </li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>开始 git flow 热点修复</h3>
|
|
|
|
|
|
|
|
|
|
<p>像其它 git flow 命令一样, 热点修复分支开始自:</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow hotfix start VERSION [BASENAME]
|
|
|
|
|
</blockquote>
|
2014-07-26 11:41:52 +02:00
|
|
|
|
<p> VERSION 参数标记着修正版本。你可以从 [BASENAME]开始,<code>[BASENAME]</code>为finish release时填写的版本号</p>
|
2013-03-14 07:38:44 +01:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="hotfix-start"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<div class="col-1">
|
|
|
|
|
<h3>完成热点修复</h3>
|
|
|
|
|
|
|
|
|
|
<p>当完成热点分支,代码归并回 develop 和 master 分支。相应地,master 分支打上修正版本的 TAG。</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
git flow hotfix finish VERSION
|
|
|
|
|
</blockquote>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="hotfix-end"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<div class="col-1"></div>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<div class="lines-close"></div>
|
|
|
|
|
<div class="lines-small-end"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="commands" href="#commands">命令</a></h2>
|
|
|
|
|
<img src="img/git-flow-commands.png" alt="git-flow commands"/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2>Backlog</h2>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>并非所有可用的命令都涵盖在这里,这里包含有最重要的部分命令。 </li>
|
|
|
|
|
<li>你依旧可以继续使用你所知道和了解的 git 命令, git flow 只是一个工具集合。</li>
|
|
|
|
|
<li>'support' 功能只是测试版本, 不建议使用</li>
|
2014-09-22 06:58:22 +02:00
|
|
|
|
<li>如果你乐意提供翻译,我很乐意整合它。</li>
|
2013-03-14 07:38:44 +01:00
|
|
|
|
</ul>
|
|
|
|
|
<p class="divider">★ ★ ★</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
|
<div class="scrollblock">
|
|
|
|
|
<h2><a name="comments" href="#comments">Comments</a></h2>
|
|
|
|
|
|
|
|
|
|
<div id="disqus_thread"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</footer>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
|
|
|
|
|
var disqus_shortname = 'gitflowcheatsheet'; // required: replace example with your forum shortname
|
|
|
|
|
|
|
|
|
|
/* * * DON'T EDIT BELOW THIS LINE * * */
|
|
|
|
|
(function () {
|
|
|
|
|
var dsq = document.createElement('script');
|
|
|
|
|
dsq.type = 'text/javascript';
|
|
|
|
|
dsq.async = true;
|
|
|
|
|
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
|
|
|
|
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
|
|
|
|
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
|
|
|
|
|
</noscript>
|
|
|
|
|
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
|
|
|
|
|
|
|
|
|
</body>
|
2013-06-20 07:48:57 +02:00
|
|
|
|
</html>
|