summaryrefslogtreecommitdiffstats
path: root/git-stash.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-31 13:25:53 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-31 13:25:53 -0700
commitc14e6ad9a230ad90c84b7f620d87fbe49a2d0342 (patch)
tree120346dc383e3d1c4219fe8c533eb22cb6af2b55 /git-stash.html
parent2a4bcbc355496c8d83b1b9f8892c4cbe8f584158 (diff)
downloadgit-htmldocs-c14e6ad9a230ad90c84b7f620d87fbe49a2d0342.tar.gz
Autogenerated HTML docs for v2.2.0-rc0
Diffstat (limited to 'git-stash.html')
-rw-r--r--git-stash.html162
1 files changed, 80 insertions, 82 deletions
diff --git a/git-stash.html b/git-stash.html
index 74dc20230..c30b612b7 100644
--- a/git-stash.html
+++ b/git-stash.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
-<meta name="generator" content="AsciiDoc 8.6.6" />
+<meta name="generator" content="AsciiDoc 8.6.9" />
<title>git-stash(1)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
@@ -87,10 +87,16 @@ ul, ol, li > p {
ul > li { color: #aaa; }
ul > li > * { color: black; }
-pre {
+.monospaced, code, pre {
+ font-family: "Courier New", Courier, monospace;
+ font-size: inherit;
+ color: navy;
padding: 0;
margin: 0;
}
+pre {
+ white-space: pre-wrap;
+}
#author {
color: #527bbd;
@@ -219,7 +225,7 @@ div.exampleblock > div.content {
}
div.imageblock div.content { padding-left: 0; }
-span.image img { border-style: none; }
+span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }
dl {
@@ -349,7 +355,7 @@ div.colist td img {
margin-bottom: 0.1em;
}
-div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
@@ -407,18 +413,14 @@ span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }
+div.unbreakable { page-break-inside: avoid; }
+
/*
* xhtml11 specific
*
* */
-tt {
- font-family: monospace;
- font-size: inherit;
- color: navy;
-}
-
div.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
@@ -452,12 +454,6 @@ div.tableblock > table[frame="vsides"] {
*
* */
-.monospaced {
- font-family: monospace;
- font-size: inherit;
- color: navy;
-}
-
table.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
@@ -537,6 +533,8 @@ body.manpage div.sectionbody {
@media print {
body.manpage div#toc { display: none; }
}
+
+
</style>
<script type="text/javascript">
/*<![CDATA[*/
@@ -581,7 +579,7 @@ toc: function (toclevels) {
function tocEntries(el, toclevels) {
var result = new Array;
- var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+ var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
@@ -610,7 +608,7 @@ toc: function (toclevels) {
var i;
for (i = 0; i < toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
- if (entry.nodeName == 'div'
+ if (entry.nodeName.toLowerCase() == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
@@ -656,7 +654,7 @@ footnotes: function () {
var entriesToRemove = [];
for (i = 0; i < noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
- if (entry.nodeName == 'div' && entry.getAttribute("class") == "footnote")
+ if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
entriesToRemove.push(entry);
}
for (i = 0; i < entriesToRemove.length; i++) {
@@ -767,21 +765,21 @@ git-stash(1) Manual Page
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Use <tt>git stash</tt> when you want to record the current state of the
+<div class="paragraph"><p>Use <code>git stash</code> when you want to record the current state of the
working directory and the index, but want to go back to a clean
working directory. The command saves your local modifications away
-and reverts the working directory to match the <tt>HEAD</tt> commit.</p></div>
+and reverts the working directory to match the <code>HEAD</code> commit.</p></div>
<div class="paragraph"><p>The modifications stashed away by this command can be listed with
-<tt>git stash list</tt>, inspected with <tt>git stash show</tt>, and restored
-(potentially on top of a different commit) with <tt>git stash apply</tt>.
-Calling <tt>git stash</tt> without any arguments is equivalent to <tt>git stash save</tt>.
+<code>git stash list</code>, inspected with <code>git stash show</code>, and restored
+(potentially on top of a different commit) with <code>git stash apply</code>.
+Calling <code>git stash</code> without any arguments is equivalent to <code>git stash save</code>.
A stash is by default listed as "WIP on <em>branchname</em> &#8230;", but
you can give a more descriptive message on the command line when
you create one.</p></div>
-<div class="paragraph"><p>The latest stash you created is stored in <tt>refs/stash</tt>; older
+<div class="paragraph"><p>The latest stash you created is stored in <code>refs/stash</code>; older
stashes are found in the reflog of this reference and can be named using
-the usual reflog syntax (e.g. <tt>stash@{0}</tt> is the most recently
-created stash, <tt>stash@{1}</tt> is the one before it, <tt>stash@{2.hours.ago}</tt>
+the usual reflog syntax (e.g. <code>stash@{0}</code> is the most recently
+created stash, <code>stash@{1}</code> is the one before it, <code>stash@{2.hours.ago}</code>
is also possible).</p></div>
</div>
</div>
@@ -794,28 +792,28 @@ save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q
</dt>
<dd>
<p>
- Save your local modifications to a new <em>stash</em>, and run <tt>git reset
- --hard</tt> to revert them. The &lt;message&gt; part is optional and gives
+ Save your local modifications to a new <em>stash</em>, and run <code>git reset
+ --hard</code> to revert them. The &lt;message&gt; part is optional and gives
the description along with the stashed state. For quickly making
a snapshot, you can omit <em>both</em> "save" and &lt;message&gt;, but giving
only &lt;message&gt; does not trigger this action to prevent a misspelled
subcommand from making an unwanted stash.
</p>
-<div class="paragraph"><p>If the <tt>--keep-index</tt> option is used, all changes already added to the
+<div class="paragraph"><p>If the <code>--keep-index</code> option is used, all changes already added to the
index are left intact.</p></div>
-<div class="paragraph"><p>If the <tt>--include-untracked</tt> option is used, all untracked files are also
-stashed and then cleaned up with <tt>git clean</tt>, leaving the working directory
-in a very clean state. If the <tt>--all</tt> option is used instead then the
+<div class="paragraph"><p>If the <code>--include-untracked</code> option is used, all untracked files are also
+stashed and then cleaned up with <code>git clean</code>, leaving the working directory
+in a very clean state. If the <code>--all</code> option is used instead then the
ignored files are stashed and cleaned in addition to the untracked files.</p></div>
-<div class="paragraph"><p>With <tt>--patch</tt>, you can interactively select hunks from the diff
+<div class="paragraph"><p>With <code>--patch</code>, you can interactively select hunks from the diff
between HEAD and the working tree to be stashed. The stash entry is
constructed such that its index state is the same as the index state
of your repository, and its worktree contains only the changes you
selected interactively. The selected changes are then rolled back
from your worktree. See the &#8220;Interactive Mode&#8221; section of
-<a href="git-add.html">git-add(1)</a> to learn how to operate the <tt>--patch</tt> mode.</p></div>
-<div class="paragraph"><p>The <tt>--patch</tt> option implies <tt>--keep-index</tt>. You can use
-<tt>--no-keep-index</tt> to override this.</p></div>
+<a href="git-add.html">git-add(1)</a> to learn how to operate the <code>--patch</code> mode.</p></div>
+<div class="paragraph"><p>The <code>--patch</code> option implies <code>--keep-index</code>. You can use
+<code>--no-keep-index</code> to override this.</p></div>
</dd>
<dt class="hdlist1">
list [&lt;options&gt;]
@@ -823,15 +821,15 @@ list [&lt;options&gt;]
<dd>
<p>
List the stashes that you currently have. Each <em>stash</em> is listed
- with its name (e.g. <tt>stash@{0}</tt> is the latest stash, <tt>stash@{1}</tt> is
+ with its name (e.g. <code>stash@{0}</code> is the latest stash, <code>stash@{1}</code> is
the one before, etc.), the name of the branch that was current when the
stash was made, and a short description of the commit the stash was
based on.
</p>
<div class="listingblock">
<div class="content">
-<pre><tt>stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
-stash@{1}: On master: 9cc0589... Add git-stash</tt></pre>
+<pre><code>stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
+stash@{1}: On master: 9cc0589... Add git-stash</code></pre>
</div></div>
<div class="paragraph"><p>The command takes options applicable to the <em>git log</em>
command to control what is shown and how. See <a href="git-log.html">git-log(1)</a>.</p></div>
@@ -842,10 +840,10 @@ show [&lt;stash&gt;]
<dd>
<p>
Show the changes recorded in the stash as a diff between the
- stashed state and its original parent. When no <tt>&lt;stash&gt;</tt> is given,
+ stashed state and its original parent. When no <code>&lt;stash&gt;</code> is given,
shows the latest one. By default, the command shows the diffstat, but
- it will accept any format known to <em>git diff</em> (e.g., <tt>git stash show
- -p stash@{1}</tt> to view the second most recent stash in patch form).
+ it will accept any format known to <em>git diff</em> (e.g., <code>git stash show
+ -p stash@{1}</code> to view the second most recent stash in patch form).
</p>
</dd>
<dt class="hdlist1">
@@ -855,27 +853,27 @@ pop [--index] [-q|--quiet] [&lt;stash&gt;]
<p>
Remove a single stashed state from the stash list and apply it
on top of the current working tree state, i.e., do the inverse
- operation of <tt>git stash save</tt>. The working directory must
+ operation of <code>git stash save</code>. The working directory must
match the index.
</p>
<div class="paragraph"><p>Applying the state can fail with conflicts; in this case, it is not
removed from the stash list. You need to resolve the conflicts by hand
-and call <tt>git stash drop</tt> manually afterwards.</p></div>
-<div class="paragraph"><p>If the <tt>--index</tt> option is used, then tries to reinstate not only the working
+and call <code>git stash drop</code> manually afterwards.</p></div>
+<div class="paragraph"><p>If the <code>--index</code> option is used, then tries to reinstate not only the working
tree&#8217;s changes, but also the index&#8217;s ones. However, this can fail, when you
have conflicts (which are stored in the index, where you therefore can no
longer apply the changes as they were originally).</p></div>
-<div class="paragraph"><p>When no <tt>&lt;stash&gt;</tt> is given, <tt>stash@{0}</tt> is assumed, otherwise <tt>&lt;stash&gt;</tt> must
-be a reference of the form <tt>stash@{&lt;revision&gt;}</tt>.</p></div>
+<div class="paragraph"><p>When no <code>&lt;stash&gt;</code> is given, <code>stash@{0}</code> is assumed, otherwise <code>&lt;stash&gt;</code> must
+be a reference of the form <code>stash@{&lt;revision&gt;}</code>.</p></div>
</dd>
<dt class="hdlist1">
apply [--index] [-q|--quiet] [&lt;stash&gt;]
</dt>
<dd>
<p>
- Like <tt>pop</tt>, but do not remove the state from the stash list. Unlike <tt>pop</tt>,
- <tt>&lt;stash&gt;</tt> may be any commit that looks like a commit created by
- <tt>stash save</tt> or <tt>stash create</tt>.
+ Like <code>pop</code>, but do not remove the state from the stash list. Unlike <code>pop</code>,
+ <code>&lt;stash&gt;</code> may be any commit that looks like a commit created by
+ <code>stash save</code> or <code>stash create</code>.
</p>
</dd>
<dt class="hdlist1">
@@ -883,17 +881,17 @@ branch &lt;branchname&gt; [&lt;stash&gt;]
</dt>
<dd>
<p>
- Creates and checks out a new branch named <tt>&lt;branchname&gt;</tt> starting from
- the commit at which the <tt>&lt;stash&gt;</tt> was originally created, applies the
- changes recorded in <tt>&lt;stash&gt;</tt> to the new working tree and index.
- If that succeeds, and <tt>&lt;stash&gt;</tt> is a reference of the form
- <tt>stash@{&lt;revision&gt;}</tt>, it then drops the <tt>&lt;stash&gt;</tt>. When no <tt>&lt;stash&gt;</tt>
+ Creates and checks out a new branch named <code>&lt;branchname&gt;</code> starting from
+ the commit at which the <code>&lt;stash&gt;</code> was originally created, applies the
+ changes recorded in <code>&lt;stash&gt;</code> to the new working tree and index.
+ If that succeeds, and <code>&lt;stash&gt;</code> is a reference of the form
+ <code>stash@{&lt;revision&gt;}</code>, it then drops the <code>&lt;stash&gt;</code>. When no <code>&lt;stash&gt;</code>
is given, applies the latest one.
</p>
-<div class="paragraph"><p>This is useful if the branch on which you ran <tt>git stash save</tt> has
-changed enough that <tt>git stash apply</tt> fails due to conflicts. Since
+<div class="paragraph"><p>This is useful if the branch on which you ran <code>git stash save</code> has
+changed enough that <code>git stash apply</code> fails due to conflicts. Since
the stash is applied on top of the commit that was HEAD at the time
-<tt>git stash</tt> was run, it restores the originally stashed state with
+<code>git stash</code> was run, it restores the originally stashed state with
no conflicts.</p></div>
</dd>
<dt class="hdlist1">
@@ -911,10 +909,10 @@ drop [-q|--quiet] [&lt;stash&gt;]
</dt>
<dd>
<p>
- Remove a single stashed state from the stash list. When no <tt>&lt;stash&gt;</tt>
- is given, it removes the latest one. i.e. <tt>stash@{0}</tt>, otherwise
- <tt>&lt;stash&gt;</tt> must be a valid stash log reference of the form
- <tt>stash@{&lt;revision&gt;}</tt>.
+ Remove a single stashed state from the stash list. When no <code>&lt;stash&gt;</code>
+ is given, it removes the latest one. i.e. <code>stash@{0}</code>, otherwise
+ <code>&lt;stash&gt;</code> must be a valid stash log reference of the form
+ <code>stash@{&lt;revision&gt;}</code>.
</p>
</dd>
<dt class="hdlist1">
@@ -946,18 +944,18 @@ store
<h2 id="_discussion">DISCUSSION</h2>
<div class="sectionbody">
<div class="paragraph"><p>A stash is represented as a commit whose tree records the state of the
-working directory, and its first parent is the commit at <tt>HEAD</tt> when
+working directory, and its first parent is the commit at <code>HEAD</code> when
the stash was created. The tree of the second parent records the
state of the index when the stash is made, and it is made a child of
-the <tt>HEAD</tt> commit. The ancestry graph looks like this:</p></div>
+the <code>HEAD</code> commit. The ancestry graph looks like this:</p></div>
<div class="literalblock">
<div class="content">
-<pre><tt> .----W
+<pre><code> .----W
/ /
------H----I</tt></pre>
+-----H----I</code></pre>
</div></div>
-<div class="paragraph"><p>where <tt>H</tt> is the <tt>HEAD</tt> commit, <tt>I</tt> is a commit that records the state
-of the index, and <tt>W</tt> is a commit that records the state of the working
+<div class="paragraph"><p>where <code>H</code> is the <code>HEAD</code> commit, <code>I</code> is a commit that records the state
+of the index, and <code>W</code> is a commit that records the state of the working
tree.</p></div>
</div>
</div>
@@ -973,20 +971,20 @@ Pulling into a dirty tree
When you are in the middle of something, you learn that there are
upstream changes that are possibly relevant to what you are
doing. When your local changes do not conflict with the changes in
-the upstream, a simple <tt>git pull</tt> will let you move forward.
+the upstream, a simple <code>git pull</code> will let you move forward.
</p>
<div class="paragraph"><p>However, there are cases in which your local changes do conflict with
-the upstream changes, and <tt>git pull</tt> refuses to overwrite your
+the upstream changes, and <code>git pull</code> refuses to overwrite your
changes. In such a case, you can stash your changes away,
perform a pull, and then unstash, like this:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>$ git pull
+<pre><code>$ git pull
...
file foobar not up to date, cannot merge.
$ git stash
$ git pull
-$ git stash pop</tt></pre>
+$ git stash pop</code></pre>
</div></div>
</dd>
<dt class="hdlist1">
@@ -1001,7 +999,7 @@ return to your original branch to make the emergency fix, like this:
</p>
<div class="listingblock">
<div class="content">
-<pre><tt># ... hack hack hack ...
+<pre><code># ... hack hack hack ...
$ git checkout -b my_wip
$ git commit -a -m "WIP"
$ git checkout master
@@ -1009,17 +1007,17 @@ $ edit emergency fix
$ git commit -a -m "Fix in a hurry"
$ git checkout my_wip
$ git reset --soft HEAD^
-# ... continue hacking ...</tt></pre>
+# ... continue hacking ...</code></pre>
</div></div>
<div class="paragraph"><p>You can use <em>git stash</em> to simplify the above, like this:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt># ... hack hack hack ...
+<pre><code># ... hack hack hack ...
$ git stash
$ edit emergency fix
$ git commit -a -m "Fix in a hurry"
$ git stash pop
-# ... continue hacking ...</tt></pre>
+# ... continue hacking ...</code></pre>
</div></div>
</dd>
<dt class="hdlist1">
@@ -1027,13 +1025,13 @@ Testing partial commits
</dt>
<dd>
<p>
-You can use <tt>git stash save --keep-index</tt> when you want to make two or
+You can use <code>git stash save --keep-index</code> when you want to make two or
more commits out of the changes in the work tree, and you want to test
each change before committing:
</p>
<div class="listingblock">
<div class="content">
-<pre><tt># ... hack hack hack ...
+<pre><code># ... hack hack hack ...
$ git add --patch foo # add just first part to the index
$ git stash save --keep-index # save all other changes to the stash
$ edit/build/test first part
@@ -1041,7 +1039,7 @@ $ git commit -m 'First part' # commit fully tested change
$ git stash pop # prepare to work on all other changes
# ... repeat above five steps until one commit remains ...
$ edit/build/test remaining parts
-$ git commit foo -m 'Remaining parts'</tt></pre>
+$ git commit foo -m 'Remaining parts'</code></pre>
</div></div>
</dd>
<dt class="hdlist1">
@@ -1056,9 +1054,9 @@ repository, but not reachable any more:
</p>
<div class="listingblock">
<div class="content">
-<pre><tt>git fsck --unreachable |
+<pre><code>git fsck --unreachable |
grep commit | cut -d\ -f3 |
-xargs git log --merges --no-walk --grep=WIP</tt></pre>
+xargs git log --merges --no-walk --grep=WIP</code></pre>
</div></div>
</dd>
</dl></div>