@@ -7,24 +7,24 @@ git-stash - Stash the changes in a dirty working directory away
7
7
8
8
SYNOPSIS
9
9
--------
10
- [verse ]
11
- ' git stash' list [<log-options >]
12
- ' git stash' show [-u | -- include-untracked | -- only-untracked] [<diff-options >] [<stash >]
13
- ' git stash' drop [-q | -- quiet] [<stash >]
14
- ' git stash' pop [-- index] [-q | -- quiet] [<stash >]
15
- ' git stash' apply [-- index] [-q | -- quiet] [<stash >]
16
- ' git stash' branch <branchname > [<stash >]
17
- ' git stash' [push [-p | -- patch] [-S | -- staged] [-k | -- [no-]keep-index] [-q | -- quiet]
10
+ [synopsis ]
11
+ git stash list [<log-options >]
12
+ git stash show [-u | -- include-untracked | -- only-untracked] [<diff-options >] [<stash >]
13
+ git stash drop [-q | -- quiet] [<stash >]
14
+ git stash pop [-- index] [-q | -- quiet] [<stash >]
15
+ git stash apply [-- index] [-q | -- quiet] [<stash >]
16
+ git stash branch <branchname > [<stash >]
17
+ git stash [push [-p | -- patch] [-S | -- staged] [-k | -- [no-]keep-index] [-q | -- quiet]
18
18
[-u | -- include-untracked] [-a | -- all] [(-m | -- message) <message >]
19
19
[-- pathspec-from-file=<file > [-- pathspec-file-nul]]
20
20
[-- ] [<pathspec >... ]]
21
- ' git stash' save [-p | -- patch] [-S | -- staged] [-k | -- [no-]keep-index] [-q | -- quiet]
22
- [-u | -- include-untracked] [-a | -- all] [<message >]
23
- ' git stash' clear
24
- ' git stash' create [<message >]
25
- ' git stash' store [(-m | -- message) <message >] [-q | -- quiet] <commit >
26
- ' git stash' export (-- print | -- to-ref <ref >) [<stash >... ]
27
- ' git stash' import <commit >
21
+ git stash save [-p | -- patch] [-S | -- staged] [-k | -- [no-]keep-index] [-q | -- quiet]
22
+ [-u | -- include-untracked] [-a | -- all] [<message >]
23
+ git stash clear
24
+ git stash create [<message >]
25
+ git stash store [(-m | -- message) <message >] [-q | -- quiet] <commit >
26
+ git stash export (-- print | -- to-ref <ref >) [<stash >... ]
27
+ git stash import <commit >
28
28
29
29
DESCRIPTION
30
30
-----------
@@ -38,7 +38,7 @@ The modifications stashed away by this command can be listed with
38
38
`git stash list` , inspected with `git stash show` , and restored
39
39
(potentially on top of a different commit) with `git stash apply` .
40
40
Calling `git stash` without any arguments is equivalent to `git stash push` .
41
- A stash is by default listed as "WIP on 'branchname' ... ", but
41
+ A stash is by default listed as "WIP on '< branchname> ' ... ", but
42
42
you can give a more descriptive message on the command line when
43
43
you create one.
44
44
@@ -47,16 +47,16 @@ stashes are found in the reflog of this reference and can be named using
47
47
the usual reflog syntax (e.g. `stash@{0}` is the most recently
48
48
created stash, `stash@{1}` is the one before it, `stash@{2.hours.ago}`
49
49
is also possible). Stashes may also be referenced by specifying just the
50
- stash index (e.g. the integer `n ` is equivalent to `stash@{n }` ).
50
+ stash index (e.g. the integer `<n> ` is equivalent to `stash@{<n> }` ).
51
51
52
52
COMMANDS
53
53
--------
54
54
55
- push [-p| -- patch] [-S| -- staged] [-k| -- [no-]keep-index] [-u| -- include-untracked] [-a| -- all] [-q| -- quiet] [(-m|-- message) <message >] [-- pathspec-from-file=<file > [-- pathspec-file-nul]] [-- ] [<pathspec >... ]::
55
+ ` push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-u | --include-untracked] [ -a | --all] [-q | --quiet] [(-m|--message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]` ::
56
56
57
57
Save your local modifications to a new 'stash entry' and roll them
58
- back to HEAD (in the working tree and in the index).
59
- The <message> part is optional and gives
58
+ back to ` HEAD` (in the working tree and in the index).
59
+ The _ <message>_ part is optional and gives
60
60
the description along with the stashed state.
61
61
+
62
62
For quickly making a snapshot, you can omit "push". In this mode,
@@ -65,14 +65,14 @@ subcommand from making an unwanted stash entry. The two exceptions to this
65
65
are `stash -p` which acts as alias for `stash push -p` and pathspec elements,
66
66
which are allowed after a double hyphen `--` for disambiguation.
67
67
68
- save [-p| --patch] [-S| --staged] [-k| --[no-]keep-index] [-u| --include-untracked] [-a| --all] [-q| --quiet] [<message>]::
68
+ ` save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-u | --include-untracked] [-a | --all] [-q | --quiet] [<message>]` ::
69
69
70
70
This option is deprecated in favour of 'git stash push'. It
71
71
differs from "stash push" in that it cannot take pathspec.
72
72
Instead, all non-option arguments are concatenated to form the stash
73
73
message.
74
74
75
- list [<log-options>]::
75
+ ` list [<log-options>]` ::
76
76
77
77
List the stash entries that you currently have. Each 'stash entry' is
78
78
listed with its name (e.g. `stash@{0}` is the latest entry, `stash@{1}` is
@@ -88,20 +88,20 @@ stash@{1}: On master: 9cc0589... Add git-stash
88
88
The command takes options applicable to the 'git log'
89
89
command to control what is shown and how. See linkgit:git-log[1].
90
90
91
- show [-u| --include-untracked| --only-untracked] [<diff-options>] [<stash>]::
91
+ ` show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]` ::
92
92
93
93
Show the changes recorded in the stash entry as a diff between the
94
94
stashed contents and the commit back when the stash entry was first
95
95
created.
96
96
By default, the command shows the diffstat, but it will accept any
97
97
format known to 'git diff' (e.g., `git stash show -p stash@{1}`
98
98
to view the second most recent entry in patch form).
99
- If no ` <diff-option>` is provided, the default behavior will be given
99
+ If no _ <diff-option>_ is provided, the default behavior will be given
100
100
by the `stash.showStat`, and `stash.showPatch` config variables. You
101
101
can also use `stash.showIncludeUntracked` to set whether
102
102
`--include-untracked` is enabled by default.
103
103
104
- pop [--index] [-q| --quiet] [<stash>]::
104
+ ` pop [--index] [-q | --quiet] [<stash>]` ::
105
105
106
106
Remove a single stashed state from the stash list and apply it
107
107
on top of the current working tree state, i.e., do the inverse
@@ -112,103 +112,100 @@ Applying the state can fail with conflicts; in this case, it is not
112
112
removed from the stash list. You need to resolve the conflicts by hand
113
113
and call `git stash drop` manually afterwards.
114
114
115
- apply [--index] [-q| --quiet] [<stash>]::
115
+ ` apply [--index] [-q | --quiet] [<stash>]` ::
116
116
117
117
Like `pop`, but do not remove the state from the stash list. Unlike `pop`,
118
118
`<stash>` may be any commit that looks like a commit created by
119
119
`stash push` or `stash create`.
120
120
121
- branch <branchname> [<stash>]::
121
+ ` branch <branchname> [<stash>]` ::
122
122
123
- Creates and checks out a new branch named ` <branchname>` starting from
124
- the commit at which the ` <stash>` was originally created, applies the
125
- changes recorded in ` <stash>` to the new working tree and index.
126
- If that succeeds, and ` <stash>` is a reference of the form
127
- `stash@{<revision>}`, it then drops the ` <stash>` .
123
+ Creates and checks out a new branch named _ <branchname>_ starting from
124
+ the commit at which the _ <stash>_ was originally created, applies the
125
+ changes recorded in _ <stash>_ to the new working tree and index.
126
+ If that succeeds, and _ <stash>_ is a reference of the form
127
+ `stash@{<revision>}`, it then drops the _ <stash>_ .
128
128
+
129
129
This is useful if the branch on which you ran `git stash push` has
130
130
changed enough that `git stash apply` fails due to conflicts. Since
131
131
the stash entry is applied on top of the commit that was HEAD at the
132
132
time `git stash` was run, it restores the originally stashed state
133
133
with no conflicts.
134
134
135
- clear::
135
+ ` clear` ::
136
136
Remove all the stash entries. Note that those entries will then
137
137
be subject to pruning, and may be impossible to recover (see
138
- 'Examples' below for a possible strategy).
139
-
140
- drop [-q|--quiet] [<stash>]::
138
+ 'EXAMPLES' below for a possible strategy).
141
139
140
+ `drop [-q | --quiet] [<stash>]`::
142
141
Remove a single stash entry from the list of stash entries.
143
142
144
- create::
145
-
143
+ `create`::
146
144
Create a stash entry (which is a regular commit object) and
147
145
return its object name, without storing it anywhere in the ref
148
146
namespace.
149
147
This is intended to be useful for scripts. It is probably not
150
148
the command you want to use; see "push" above.
151
149
152
- store::
150
+ ` store` ::
153
151
154
152
Store a given stash created via 'git stash create' (which is a
155
153
dangling merge commit) in the stash ref, updating the stash
156
154
reflog. This is intended to be useful for scripts. It is
157
155
probably not the command you want to use; see "push" above.
158
156
159
- export ( --print | --to-ref <ref> ) [<stash>...]::
157
+ ` export ( --print | --to-ref <ref> ) [<stash>...]` ::
160
158
161
159
Export the specified stashes, or all of them if none are specified, to
162
160
a chain of commits which can be transferred using the normal fetch and
163
161
push mechanisms, then imported using the `import` subcommand.
164
162
165
- import <commit>::
166
-
163
+ `import <commit>`::
167
164
Import the specified stashes from the specified commit, which must have been
168
165
created by `export`, and add them to the list of stashes. To replace the
169
166
existing stashes, use `clear` first.
170
167
171
168
OPTIONS
172
169
-------
173
- -a ::
174
- --all::
170
+ `-a` ::
171
+ ` --all` ::
175
172
This option is only valid for `push` and `save` commands.
176
173
+
177
174
All ignored and untracked files are also stashed and then cleaned
178
175
up with `git clean`.
179
176
180
- -u ::
181
- --include-untracked::
182
- --no-include-untracked::
177
+ `-u` ::
178
+ ` --include-untracked` ::
179
+ ` --no-include-untracked` ::
183
180
When used with the `push` and `save` commands,
184
181
all untracked files are also stashed and then cleaned up with
185
182
`git clean`.
186
183
+
187
184
When used with the `show` command, show the untracked files in the stash
188
185
entry as part of the diff.
189
186
190
- --only-untracked::
187
+ ` --only-untracked` ::
191
188
This option is only valid for the `show` command.
192
189
+
193
190
Show only the untracked files in the stash entry as part of the diff.
194
191
195
- --index::
192
+ ` --index` ::
196
193
This option is only valid for `pop` and `apply` commands.
197
194
+
198
195
Tries to reinstate not only the working tree's changes, but also
199
196
the index's ones. However, this can fail, when you have conflicts
200
197
(which are stored in the index, where you therefore can no longer
201
198
apply the changes as they were originally).
202
199
203
- -k ::
204
- --keep-index::
205
- --no-keep-index::
200
+ `-k` ::
201
+ ` --keep-index` ::
202
+ ` --no-keep-index` ::
206
203
This option is only valid for `push` and `save` commands.
207
204
+
208
205
All changes already added to the index are left intact.
209
206
210
- -p ::
211
- --patch::
207
+ `-p` ::
208
+ ` --patch` ::
212
209
This option is only valid for `push` and `save` commands.
213
210
+
214
211
Interactively select hunks from the diff between HEAD and the
@@ -224,8 +221,8 @@ The `--patch` option implies `--keep-index`. You can use
224
221
225
222
include::diff-context-options.adoc[]
226
223
227
- -S ::
228
- --staged::
224
+ `-S` ::
225
+ ` --staged` ::
229
226
This option is only valid for `push` and `save` commands.
230
227
+
231
228
Stash only the changes that are currently staged. This is similar to
@@ -234,49 +231,49 @@ of current branch.
234
231
+
235
232
The `--patch` option has priority over this one.
236
233
237
- --pathspec-from-file=<file>::
234
+ ` --pathspec-from-file=<file>` ::
238
235
This option is only valid for `push` command.
239
236
+
240
- Pathspec is passed in ` <file>` instead of commandline args. If
241
- ` <file>` is exactly `-` then standard input is used. Pathspec
237
+ Pathspec is passed in _ <file>_ instead of commandline args. If
238
+ _ <file>_ is exactly `-` then standard input is used. Pathspec
242
239
elements are separated by LF or CR/LF. Pathspec elements can be
243
240
quoted as explained for the configuration variable `core.quotePath`
244
241
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
245
242
global `--literal-pathspecs`.
246
243
247
- --pathspec-file-nul::
244
+ ` --pathspec-file-nul` ::
248
245
This option is only valid for `push` command.
249
246
+
250
247
Only meaningful with `--pathspec-from-file`. Pathspec elements are
251
248
separated with NUL character and all other characters are taken
252
249
literally (including newlines and quotes).
253
250
254
- -q ::
255
- --quiet::
251
+ `-q` ::
252
+ ` --quiet` ::
256
253
This option is only valid for `apply`, `drop`, `pop`, `push`,
257
254
`save`, `store` commands.
258
255
+
259
256
Quiet, suppress feedback messages.
260
257
261
- --print::
258
+ ` --print` ::
262
259
This option is only valid for the `export` command.
263
260
+
264
261
Create the chain of commits representing the exported stashes without
265
262
storing it anywhere in the ref namespace and print the object ID to
266
263
standard output. This is designed for scripts.
267
264
268
- --to-ref::
265
+ ` --to-ref` ::
269
266
This option is only valid for the `export` command.
270
267
+
271
268
Create the chain of commits representing the exported stashes and store
272
269
it to the specified ref.
273
270
274
- \-- ::
271
+ `--` ::
275
272
This option is only valid for `push` command.
276
273
+
277
274
Separates pathspec from options for disambiguation purposes.
278
275
279
- <pathspec>...::
276
+ ` <pathspec>...` ::
280
277
This option is only valid for `push` command.
281
278
+
282
279
The new stash entry records the modified states only for the files
@@ -286,11 +283,11 @@ too, leaving files that do not match the pathspec intact.
286
283
+
287
284
For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
288
285
289
- <stash>::
286
+ _ <stash>_ ::
290
287
This option is only valid for `apply`, `branch`, `drop`, `pop`,
291
288
`show`, and `export` commands.
292
289
+
293
- A reference of the form `stash@{<revision>}`. When no ` <stash>` is
290
+ A reference of the form `stash@{<revision>}`. When no _ <stash>_ is
294
291
given, the latest stash is assumed (that is, `stash@{0}`).
295
292
296
293
DISCUSSION
@@ -419,6 +416,7 @@ CONFIGURATION
419
416
420
417
include::includes/cmd-config-section-all.adoc[]
421
418
419
+ :git-stash: 1
422
420
include::config/stash.adoc[]
423
421
424
422
0 commit comments