mirror of
https://github.com/danielkummer/git-flow-cheatsheet.git
synced 2024-11-07 08:34:30 +01:00
376 lines
14 KiB
HTML
376 lines
14 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN" xmlns="http://www.w3.org/1999/html">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<title>git-flow 备忘清单</title>
|
||
<link href='https://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 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>
|
||
<div id="banner"><a href="https://github.com/danielkummer/git-flow-cheatsheet">Fork me on GitHub</a></div>
|
||
<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> 创建
|
||
|
||
</p>
|
||
<p id="desc">使用 git-flow 进行有效的分支实践。 by <a href="http://nvie.com/" target="_blank">Vincent Driessen</a></p>
|
||
<p id="translations">翻译:
|
||
<a href="index.html" title="english">English</a> -
|
||
<a href="index.es_ES.html" title="spanish">Castellano</a> -
|
||
<a href="index.pt_BR.html" title="Brazilian Portugues">Brazilian Portugues</a> -
|
||
<a href="index.zh_TW.html" title="Traditional Chinese">繁體中文(Traditional Chinese)</a> -
|
||
<a href="#" class="active" title="Simplified Chinese">简体中文(Simplified Chinese)</a>
|
||
<a href="index.ja_JP.html" title="日本語">日本語</a> -
|
||
<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> -
|
||
<a href="index.it_IT.html" title="Italiano">Italiano</a> -
|
||
<a href="index.nl_NL.html" title="Nederlands">Nederlands</a> -
|
||
<a href="index.ru_RU.html" title="Russian">Русский (Russian)</a> -
|
||
<a href="index.de_DE.html" title="German">Deutsch (German)</a> -
|
||
<a href="index.ro_RO.html" title="Romanian">Română (Romanian)</a> -
|
||
<a href="index.el_GR.html" title="Ελληνικά (Greek)">Ελληνικά (Greek)</a> -
|
||
<a href="index.uk_UA.html" title="Ukrainian">Українська (Ukrainian)</a> -
|
||
<a href="index.vi_VN.html" title="Tiếng Việt">Tiếng Việt (Vietnamese)</a> -
|
||
<a href="index.pl_PL.html" title="Polish">Polski</a> -
|
||
<a href="index.ar_MA.html" title="العربية">العربية</a> -
|
||
<a href="index.fa_FA.html" title="فارسی">فارسی</a> -
|
||
<a href="index.az_AZ.html" title="Polish">Azərbaycanca (Azerbaijani)</a>
|
||
<a href="index.id_ID.html" title="Bahasa Indonesia">Bahasa Indonesia</a>
|
||
</p>
|
||
</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>macOS 程序 <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 可以工作在 macOS, Linux 和 Windows之下</li>
|
||
</ul>
|
||
<p class="divider">★ ★ ★</p>
|
||
<div class="col-1">
|
||
<h3>macOS</h3>
|
||
<span>Homebrew</span>
|
||
<blockquote>
|
||
$ brew install git-flow-avh
|
||
</blockquote>
|
||
<span>Macports</span>
|
||
<blockquote>
|
||
$ port install git-flow-avh
|
||
</blockquote>
|
||
<h3>Linux</h3>
|
||
<blockquote>
|
||
$ apt-get install git-flow
|
||
</blockquote>
|
||
<h3>Windows (Cygwin)</h3>
|
||
<blockquote>
|
||
$ wget -q -O - --no-check-certificate
|
||
https://raw.github.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh install stable | bash
|
||
</blockquote>
|
||
<p>安装 git-flow, 你需要 wget 和 util-linux。</p>
|
||
</div>
|
||
<div class="col-2">
|
||
<p>
|
||
更多的 git flow 安装指引,请阅读 <a href="https://github.com/petervanderdoes/gitflow-avh/wiki/Installation" 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/>
|
||
发布新特性分支到远程服务器,所以,其它用户也可以使用这分支。
|
||
</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 origin MYFEATURE
|
||
</blockquote>
|
||
|
||
<p>你可以使用 <code> git flow feature track MYFEATURE</code> 跟踪在origin上的特性分支。</p>
|
||
</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>
|
||
<p> VERSION 参数标记着修正版本。你可以从 [BASENAME]开始,<code>[BASENAME]</code>为finish release时填写的版本号</p>
|
||
</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>
|
||
<li>如果你乐意提供翻译,我很乐意整合它。</li>
|
||
</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 = 'https://' + 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>
|
||
</html>
|