summaryrefslogtreecommitdiffstats
path: root/git-checkout.html
diff options
context:
space:
mode:
authorJunio C Hamano <junio@kernel.org>2010-06-21 15:23:55 +0000
committerJunio C Hamano <junio@kernel.org>2010-06-21 15:23:55 +0000
commitbb88cf46ef8a2521a253db9ab576e12202a54fa5 (patch)
treebbc5092df07bff8072a1d42a422ab68b4dbd7aac /git-checkout.html
parentf5de4cf4e1e8bccd17515d71186e752f4716cac9 (diff)
downloadgit-htmldocs-bb88cf46ef8a2521a253db9ab576e12202a54fa5.tar.gz
Autogenerated HTML docs for v1.7.1-524-g6df2
Diffstat (limited to 'git-checkout.html')
-rw-r--r--git-checkout.html98
1 files changed, 63 insertions, 35 deletions
diff --git a/git-checkout.html b/git-checkout.html
index c32d65f9a..e7173dcac 100644
--- a/git-checkout.html
+++ b/git-checkout.html
@@ -328,29 +328,51 @@ git-checkout(1) Manual Page
</div>
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="para"><p>When &lt;paths&gt; are not given, this command switches branches by
-updating the index, working tree, and HEAD to reflect the specified
+<div class="para"><p>Updates files in the working tree to match the version in the index
+or the specified tree. If no paths are given, <em>git checkout</em> will
+also update <tt>HEAD</tt> to set the specified branch as the current
branch.</p></div>
-<div class="para"><p>If <tt>-b</tt> is given, a new branch is created and checked out, as if
-<a href="git-branch.html">git-branch(1)</a> were called; in this case you can
-use the --track or --no-track options, which will be passed to <tt>git
-branch</tt>. As a convenience, --track without <tt>-b</tt> implies branch
-creation; see the description of --track below.</p></div>
-<div class="para"><p>When &lt;paths&gt; or --patch are given, this command does <strong>not</strong> switch
-branches. It updates the named paths in the working tree from
-the index file, or from a named &lt;tree-ish&gt; (most often a commit). In
-this case, the <tt>-b</tt> and <tt>--track</tt> options are meaningless and giving
-either of them results in an error. The &lt;tree-ish&gt; argument can be
-used to specify a specific tree-ish (i.e. commit, tag or tree)
-to update the index for the given paths before updating the
-working tree.</p></div>
-<div class="para"><p>The index may contain unmerged entries after a failed merge. By
-default, if you try to check out such an entry from the index, the
+<div class="vlist"><dl>
+<dt>
+<em>git checkout</em> [&lt;branch&gt;]
+</dt>
+<dt>
+<em>git checkout</em> -b &lt;new branch&gt; [&lt;start point&gt;]
+</dt>
+<dd>
+<p>
+ This form switches branches by updating the index, working
+ tree, and HEAD to reflect the specified branch.
+</p>
+<div class="para"><p>If <tt>-b</tt> is given, a new branch is created as if <a href="git-branch.html">git-branch(1)</a>
+were called and then checked out; in this case you can
+use the <tt>--track</tt> or <tt>--no-track</tt> options, which will be passed to
+<em>git branch</em>. As a convenience, <tt>--track</tt> without <tt>-b</tt> implies branch
+creation; see the description of <tt>--track</tt> below.</p></div>
+</dd>
+<dt>
+<em>git checkout</em> [--patch] [&lt;tree-ish&gt;] [--] &lt;pathspec&gt;&#8230;
+</dt>
+<dd>
+<p>
+ When &lt;paths&gt; or <tt>--patch</tt> are given, <em>git checkout</em> <strong>not</strong> switch
+ branches. It updates the named paths in the working tree from
+ the index file or from a named &lt;tree-ish&gt; (most often a commit). In
+ this case, the <tt>-b</tt> and <tt>--track</tt> options are meaningless and giving
+ either of them results in an error. The &lt;tree-ish&gt; argument can be
+ used to specify a specific tree-ish (i.e. commit, tag or tree)
+ to update the index for the given paths before updating the
+ working tree.
+</p>
+<div class="para"><p>The index may contain unmerged entries because of a previous failed merge.
+By default, if you try to check out such an entry from the index, the
checkout operation will fail and nothing will be checked out.
-Using -f will ignore these unmerged entries. The contents from a
+Using <tt>-f</tt> will ignore these unmerged entries. The contents from a
specific side of the merge can be checked out of the index by
-using --ours or --theirs. With -m, changes made to the working tree
-file can be discarded to recreate the original conflicted merge result.</p></div>
+using <tt>--ours</tt> or <tt>--theirs</tt>. With <tt>-m</tt>, changes made to the working tree
+file can be discarded to re-create the original conflicted merge result.</p></div>
+</dd>
+</dl></div>
</div>
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
@@ -446,21 +468,27 @@ explicitly give a name with <em>-b</em> in such a case.</p></div>
</dt>
<dd>
<p>
- Create a new branch named &lt;new_branch&gt;, unparented to any other
- branch. The new branch you switch to does not have any commit
- and after the first one it will become the root of a new history
- completely unconnected from all the other branches.
+ Create a new <em>orphan</em> branch, named &lt;new_branch&gt;, started from
+ &lt;start_point&gt; and switch to it. The first commit made on this
+ new branch will have no parents and it will be the root of a new
+ history totally disconnected from all the other branches and
+ commits.
</p>
-<div class="para"><p>When you use "--orphan", the index and the working tree are kept intact.
-This allows you to start a new history that records set of paths similar
-to that of the start-point commit, which is useful when you want to keep
-different branches for different audiences you are working to like when
-you have an open source and commercial versions of a software, for example.</p></div>
-<div class="para"><p>If you want to start a disconnected history that records set of paths
-totally different from the original branch, you may want to first clear
-the index and the working tree, by running "git rm -rf ." from the
-top-level of the working tree, before preparing your files (by copying
-from elsewhere, extracting a tarball, etc.) in the working tree.</p></div>
+<div class="para"><p>The index and the working tree are adjusted as if you had previously run
+"git checkout &lt;start_point&gt;". This allows you to start a new history
+that records a set of paths similar to &lt;start_point&gt; by easily running
+"git commit -a" to make the root commit.</p></div>
+<div class="para"><p>This can be useful when you want to publish the tree from a commit
+without exposing its full history. You might want to do this to publish
+an open source branch of a project whose current tree is "clean", but
+whose full history contains proprietary or otherwise encumbered bits of
+code.</p></div>
+<div class="para"><p>If you want to start a disconnected history that records a set of paths
+that is totally different from the one of &lt;start_point&gt;, then you should
+clear the index and the working tree right after creating the orphan
+branch by running "git rm -rf ." from the top level of the working tree.
+Afterwards you will be ready to prepare your new files, repopulating the
+working tree, by copying them from elsewhere, extracting a tarball, etc.</p></div>
</dd>
<dt>
-m
@@ -699,7 +727,7 @@ $ git add frotz</tt></pre>
</div>
<div id="footer">
<div id="footer-text">
-Last updated 2010-06-02 23:32:07 UTC
+Last updated 2010-06-21 15:23:40 UTC
</div>
</div>
</body>