Browse Source

Documentation: teach stash/pop workflow instead of stash/apply

Recent discussion on the list showed some comments in favour of a
stash/pop workflow:

  http://marc.info/?l=git&m=124234911423358&w=2
  http://marc.info/?l=git&m=124235348327711&w=2

Change the stash documentation and examples to document pop in its own
right (and apply in terms of pop), and use stash/pop in the examples.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Thomas Rast 16 years ago committed by Junio C Hamano
parent
commit
d183663785
  1. 30
      Documentation/git-stash.txt
  2. 4
      Documentation/user-manual.txt

30
Documentation/git-stash.txt

@ -75,14 +75,22 @@ show [<stash>]::
it will accept any format known to 'git-diff' (e.g., `git stash show it will accept any format known to 'git-diff' (e.g., `git stash show
-p stash@\{1}` to view the second most recent stash in patch form). -p stash@\{1}` to view the second most recent stash in patch form).


apply [--index] [<stash>]:: pop [<stash>]::


Restore the changes recorded in the stash on top of the current Remove a single stashed state from the stash list and apply it
working tree state. When no `<stash>` is given, applies the latest on top of the current working tree state, i.e., do the inverse
one. The working directory must match the index. operation of `git stash save`. The working directory must
match the index.
+ +
This operation can fail with conflicts; you need to resolve them Applying the state can fail with conflicts; in this case, it is not
by hand in the working tree. removed from the stash list. You need to resolve the conflicts by hand
and call `git stash drop` manually afterwards.
+
When no `<stash>` is given, `stash@\{0}` is assumed. See also `apply`.

apply [--index] [<stash>]::

Like `pop`, but do not remove the state from the stash list.
+ +
If the `--index` option is used, then tries to reinstate not only the working If the `--index` option is used, then tries to reinstate not only the working
tree's changes, but also the index's ones. However, this can fail, when you tree's changes, but also the index's ones. However, this can fail, when you
@ -112,12 +120,6 @@ drop [<stash>]::
Remove a single stashed state from the stash list. When no `<stash>` Remove a single stashed state from the stash list. When no `<stash>`
is given, it removes the latest one. i.e. `stash@\{0}` is given, it removes the latest one. i.e. `stash@\{0}`


pop [<stash>]::

Remove a single stashed state from the stash list and apply on top
of the current working tree state. When no `<stash>` is given,
`stash@\{0}` is assumed. See also `apply`.

create:: create::


Create a stash (which is a regular commit object) and return its Create a stash (which is a regular commit object) and return its
@ -163,7 +165,7 @@ $ git pull
file foobar not up to date, cannot merge. file foobar not up to date, cannot merge.
$ git stash $ git stash
$ git pull $ git pull
$ git stash apply $ git stash pop
---------------------------------------------------------------- ----------------------------------------------------------------


Interrupted workflow:: Interrupted workflow::
@ -192,7 +194,7 @@ You can use 'git-stash' to simplify the above, like this:
$ git stash $ git stash
$ edit emergency fix $ edit emergency fix
$ git commit -a -m "Fix in a hurry" $ git commit -a -m "Fix in a hurry"
$ git stash apply $ git stash pop
# ... continue hacking ... # ... continue hacking ...
---------------------------------------------------------------- ----------------------------------------------------------------



4
Documentation/user-manual.txt

@ -1520,10 +1520,10 @@ $ git commit -a -m "blorpl: typofix"
------------------------------------------------ ------------------------------------------------


After that, you can go back to what you were working on with After that, you can go back to what you were working on with
`git stash apply`: `git stash pop`:


------------------------------------------------ ------------------------------------------------
$ git stash apply $ git stash pop
------------------------------------------------ ------------------------------------------------





Loading…
Cancel
Save