@@ -15,6 +15,7 @@ SYNOPSIS
15
15
'git stash' branch <branchname> [<stash>]
16
16
'git stash' [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
17
17
[-u|--include-untracked] [-a|--all] [-m|--message <message>]
18
+ [--pathspec-from-file=<file> [--pathspec-file-nul]]
18
19
[--] [<pathspec>...]]
19
20
'git stash' clear
20
21
'git stash' create [<message>]
@@ -43,10 +44,10 @@ created stash, `stash@{1}` is the one before it, `stash@{2.hours.ago}`
43
44
is also possible). Stashes may also be referenced by specifying just the
44
45
stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
45
46
46
- OPTIONS
47
- -------
47
+ COMMANDS
48
+ --------
48
49
49
- push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--] [<pathspec>...]::
50
+ push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [-- ] [<pathspec>...]::
50
51
51
52
Save your local modifications to a new 'stash entry' and roll them
52
53
back to HEAD (in the working tree and in the index).
@@ -56,38 +57,13 @@ push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q
56
57
For quickly making a snapshot, you can omit "push". In this mode,
57
58
non-option arguments are not allowed to prevent a misspelled
58
59
subcommand from making an unwanted stash entry. The two exceptions to this
59
- are `stash -p` which acts as alias for `stash push -p` and pathspecs ,
60
+ are `stash -p` which acts as alias for `stash push -p` and pathspec elements ,
60
61
which are allowed after a double hyphen `--` for disambiguation.
61
- +
62
- When pathspec is given to 'git stash push', the new stash entry records the
63
- modified states only for the files that match the pathspec. The index
64
- entries and working tree files are then rolled back to the state in
65
- HEAD only for these files, too, leaving files that do not match the
66
- pathspec intact.
67
- +
68
- If the `--keep-index` option is used, all changes already added to the
69
- index are left intact.
70
- +
71
- If the `--include-untracked` option is used, all untracked files are also
72
- stashed and then cleaned up with `git clean`, leaving the working directory
73
- in a very clean state. If the `--all` option is used instead then the
74
- ignored files are stashed and cleaned in addition to the untracked files.
75
- +
76
- With `--patch`, you can interactively select hunks from the diff
77
- between HEAD and the working tree to be stashed. The stash entry is
78
- constructed such that its index state is the same as the index state
79
- of your repository, and its worktree contains only the changes you
80
- selected interactively. The selected changes are then rolled back
81
- from your worktree. See the ``Interactive Mode'' section of
82
- linkgit:git-add[1] to learn how to operate the `--patch` mode.
83
- +
84
- The `--patch` option implies `--keep-index`. You can use
85
- `--no-keep-index` to override this.
86
62
87
63
save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::
88
64
89
65
This option is deprecated in favour of 'git stash push'. It
90
- differs from "stash push" in that it cannot take pathspecs .
66
+ differs from "stash push" in that it cannot take pathspec .
91
67
Instead, all non-option arguments are concatenated to form the stash
92
68
message.
93
69
@@ -111,7 +87,7 @@ show [<options>] [<stash>]::
111
87
112
88
Show the changes recorded in the stash entry as a diff between the
113
89
stashed contents and the commit back when the stash entry was first
114
- created. When no `<stash>` is given, it shows the latest one.
90
+ created.
115
91
By default, the command shows the diffstat, but it will accept any
116
92
format known to 'git diff' (e.g., `git stash show -p stash@{1}`
117
93
to view the second most recent entry in patch form).
@@ -128,14 +104,6 @@ pop [--index] [-q|--quiet] [<stash>]::
128
104
Applying the state can fail with conflicts; in this case, it is not
129
105
removed from the stash list. You need to resolve the conflicts by hand
130
106
and call `git stash drop` manually afterwards.
131
- +
132
- If the `--index` option is used, then tries to reinstate not only the working
133
- tree's changes, but also the index's ones. However, this can fail, when you
134
- have conflicts (which are stored in the index, where you therefore can no
135
- longer apply the changes as they were originally).
136
- +
137
- When no `<stash>` is given, `stash@{0}` is assumed, otherwise `<stash>` must
138
- be a reference of the form `stash@{<revision>}`.
139
107
140
108
apply [--index] [-q|--quiet] [<stash>]::
141
109
@@ -149,8 +117,7 @@ branch <branchname> [<stash>]::
149
117
the commit at which the `<stash>` was originally created, applies the
150
118
changes recorded in `<stash>` to the new working tree and index.
151
119
If that succeeds, and `<stash>` is a reference of the form
152
- `stash@{<revision>}`, it then drops the `<stash>`. When no `<stash>`
153
- is given, applies the latest one.
120
+ `stash@{<revision>}`, it then drops the `<stash>`.
154
121
+
155
122
This is useful if the branch on which you ran `git stash push` has
156
123
changed enough that `git stash apply` fails due to conflicts. Since
@@ -166,9 +133,6 @@ clear::
166
133
drop [-q|--quiet] [<stash>]::
167
134
168
135
Remove a single stash entry from the list of stash entries.
169
- When no `<stash>` is given, it removes the latest one.
170
- i.e. `stash@{0}`, otherwise `<stash>` must be a valid stash
171
- log reference of the form `stash@{<revision>}`.
172
136
173
137
create::
174
138
@@ -185,6 +149,98 @@ store::
185
149
reflog. This is intended to be useful for scripts. It is
186
150
probably not the command you want to use; see "push" above.
187
151
152
+ OPTIONS
153
+ -------
154
+ -a::
155
+ --all::
156
+ This option is only valid for `push` and `save` commands.
157
+ +
158
+ All ignored and untracked files are also stashed and then cleaned
159
+ up with `git clean`.
160
+
161
+ -u::
162
+ --include-untracked::
163
+ This option is only valid for `push` and `save` commands.
164
+ +
165
+ All untracked files are also stashed and then cleaned up with
166
+ `git clean`.
167
+
168
+ --index::
169
+ This option is only valid for `pop` and `apply` commands.
170
+ +
171
+ Tries to reinstate not only the working tree's changes, but also
172
+ the index's ones. However, this can fail, when you have conflicts
173
+ (which are stored in the index, where you therefore can no longer
174
+ apply the changes as they were originally).
175
+
176
+ -k::
177
+ --keep-index::
178
+ --no-keep-index::
179
+ This option is only valid for `push` and `save` commands.
180
+ +
181
+ All changes already added to the index are left intact.
182
+
183
+ -p::
184
+ --patch::
185
+ This option is only valid for `push` and `save` commands.
186
+ +
187
+ Interactively select hunks from the diff between HEAD and the
188
+ working tree to be stashed. The stash entry is constructed such
189
+ that its index state is the same as the index state of your
190
+ repository, and its worktree contains only the changes you selected
191
+ interactively. The selected changes are then rolled back from your
192
+ worktree. See the ``Interactive Mode'' section of linkgit:git-add[1]
193
+ to learn how to operate the `--patch` mode.
194
+ +
195
+ The `--patch` option implies `--keep-index`. You can use
196
+ `--no-keep-index` to override this.
197
+
198
+ --pathspec-from-file=<file>::
199
+ This option is only valid for `push` command.
200
+ +
201
+ Pathspec is passed in `<file>` instead of commandline args. If
202
+ `<file>` is exactly `-` then standard input is used. Pathspec
203
+ elements are separated by LF or CR/LF. Pathspec elements can be
204
+ quoted as explained for the configuration variable `core.quotePath`
205
+ (see linkgit:git-config[1]). See also `--pathspec-file-nul` and
206
+ global `--literal-pathspecs`.
207
+
208
+ --pathspec-file-nul::
209
+ This option is only valid for `push` command.
210
+ +
211
+ Only meaningful with `--pathspec-from-file`. Pathspec elements are
212
+ separated with NUL character and all other characters are taken
213
+ literally (including newlines and quotes).
214
+
215
+ -q::
216
+ --quiet::
217
+ This option is only valid for `apply`, `drop`, `pop`, `push`,
218
+ `save`, `store` commands.
219
+ +
220
+ Quiet, suppress feedback messages.
221
+
222
+ \--::
223
+ This option is only valid for `push` command.
224
+ +
225
+ Separates pathspec from options for disambiguation purposes.
226
+
227
+ <pathspec>...::
228
+ This option is only valid for `push` command.
229
+ +
230
+ The new stash entry records the modified states only for the files
231
+ that match the pathspec. The index entries and working tree files
232
+ are then rolled back to the state in HEAD only for these files,
233
+ too, leaving files that do not match the pathspec intact.
234
+ +
235
+ For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
236
+
237
+ <stash>::
238
+ This option is only valid for `apply`, `branch`, `drop`, `pop`,
239
+ `show` commands.
240
+ +
241
+ A reference of the form `stash@{<revision>}`. When no `<stash>` is
242
+ given, the latest stash is assumed (that is, `stash@{0}`).
243
+
188
244
DISCUSSION
189
245
----------
190
246
0 commit comments