Skip to content

Commit ef6c766

Browse files
authored
Merge pull request progit#1147 from rpjday/topic/rpjday/stashing_and_cleaning
stashing/cleaning: clean up some wording, mention "--all" for stashing
2 parents 73336a5 + 4992dd9 commit ef6c766

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

book/07-git-tools/sections/stashing-cleaning.asc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Changes not staged for commit:
3737
modified: lib/simplegit.rb
3838
----
3939

40-
Now you want to switch branches, but you don’t want to commit what you’ve been working on yet; so you’ll stash the changes.
41-
To push a new stash onto your stack, run `git stash` or `git stash save`:
40+
Now you want to switch branches, but you don’t want to commit what you’ve been working on yet, so you’ll stash the changes.
41+
To push a new stash onto your stack, run `git stash` or `git stash push`:
4242

4343
[source,console]
4444
----
@@ -69,7 +69,7 @@ stash@{1}: WIP on master: c264051 Revert "added file_size"
6969
stash@{2}: WIP on master: 21d80a5 added number to log
7070
----
7171

72-
In this case, two stashes were done previously, so you have access to three different stashed works.
72+
In this case, two stashes were saved previously, so you have access to three different stashed works.
7373
You can reapply the one you just stashed by using the command shown in the help output of the original stash command: `git stash apply`.
7474
If you want to apply one of the older stashes, you can specify it by naming it, like this: `git stash apply stash@{2}`.
7575
If you don’t specify a stash, Git assumes the most recent stash and tries to apply it:
@@ -132,7 +132,7 @@ You can also run `git stash pop` to apply the stash and then immediately drop it
132132
==== Creative Stashing
133133

134134
There are a few stash variants that may also be helpful.
135-
The first option that is quite popular is the `--keep-index` option to the `stash save` command.
135+
The first option that is quite popular is the `--keep-index` option to the `git stash` command.
136136
This tells Git to not only include all staged content in the stash being created, but simultaneously leave it in the index.
137137

138138
[source,console]
@@ -152,6 +152,7 @@ M index.html
152152
Another common thing you may want to do with stash is to stash the untracked files as well as the tracked ones.
153153
By default, `git stash` will stash only modified and staged _tracked_ files.
154154
If you specify `--include-untracked` or `-u`, Git will include untracked files in the stash being created.
155+
However, including untracked files in the stash will still not include explicitly _ignored_ files; to additionally include ignored files, use `--all` (or just `-a`).
155156

156157
[source,console]
157158
----
@@ -197,7 +198,7 @@ Saved working directory and index state WIP on master: 1b65b17 added the index f
197198

198199
If you stash some work, leave it there for a while, and continue on the branch from which you stashed the work, you may have a problem reapplying the work.
199200
If the apply tries to modify a file that you’ve since modified, you’ll get a merge conflict and will have to try to resolve it.
200-
If you want an easier way to test the stashed changes again, you can run `git stash branch <branch>`, which creates a new branch for you with your selected branch name, checks out the commit you were on when you stashed your work, reapplies your work there, and then drops the stash if it applies successfully:
201+
If you want an easier way to test the stashed changes again, you can run `git stash branch <new branchname>`, which creates a new branch for you with your selected branch name, checks out the commit you were on when you stashed your work, reapplies your work there, and then drops the stash if it applies successfully:
201202

202203
[source,console]
203204
----

0 commit comments

Comments
 (0)