1GIT-STATUS(1) Git Manual GIT-STATUS(1)
2
3
4
6 git-status - Show the working tree status
7
9 git status [<options>...] [--] [<pathspec>...]
10
11
13 Displays paths that have differences between the index file and the
14 current HEAD commit, paths that have differences between the working
15 tree and the index file, and paths in the working tree that are not
16 tracked by Git (and are not ignored by gitignore(5)). The first are
17 what you would commit by running git commit; the second and third are
18 what you could commit by running git add before running git commit.
19
21 -s, --short
22 Give the output in the short-format.
23
24 -b, --branch
25 Show the branch and tracking info even in short-format.
26
27 --show-stash
28 Show the number of entries currently stashed away.
29
30 --porcelain[=<version>]
31 Give the output in an easy-to-parse format for scripts. This is
32 similar to the short output, but will remain stable across Git
33 versions and regardless of user configuration. See below for
34 details.
35
36 The version parameter is used to specify the format version. This
37 is optional and defaults to the original version v1 format.
38
39 --long
40 Give the output in the long-format. This is the default.
41
42 -v, --verbose
43 In addition to the names of files that have been changed, also show
44 the textual changes that are staged to be committed (i.e., like the
45 output of git diff --cached). If -v is specified twice, then also
46 show the changes in the working tree that have not yet been staged
47 (i.e., like the output of git diff).
48
49 -u[<mode>], --untracked-files[=<mode>]
50 Show untracked files.
51
52 The mode parameter is used to specify the handling of untracked
53 files. It is optional: it defaults to all, and if specified, it
54 must be stuck to the option (e.g. -uno, but not -u no).
55
56 The possible options are:
57
58 · no - Show no untracked files.
59
60 · normal - Shows untracked files and directories.
61
62 · all - Also shows individual files in untracked directories.
63
64 When -u option is not used, untracked files and directories are
65 shown (i.e. the same as specifying normal), to help you avoid
66 forgetting to add newly created files. Because it takes extra
67 work to find untracked files in the filesystem, this mode may
68 take some time in a large working tree. Consider enabling
69 untracked cache and split index if supported (see git
70 update-index --untracked-cache and git update-index
71 --split-index), Otherwise you can use no to have git status
72 return more quickly without showing untracked files.
73
74 The default can be changed using the status.showUntrackedFiles
75 configuration variable documented in git-config(1).
76
77 --ignore-submodules[=<when>]
78 Ignore changes to submodules when looking for changes. <when> can
79 be either "none", "untracked", "dirty" or "all", which is the
80 default. Using "none" will consider the submodule modified when it
81 either contains untracked or modified files or its HEAD differs
82 from the commit recorded in the superproject and can be used to
83 override any settings of the ignore option in git-config(1) or
84 gitmodules(5). When "untracked" is used submodules are not
85 considered dirty when they only contain untracked content (but they
86 are still scanned for modified content). Using "dirty" ignores all
87 changes to the work tree of submodules, only changes to the commits
88 stored in the superproject are shown (this was the behavior before
89 1.7.0). Using "all" hides all changes to submodules (and suppresses
90 the output of submodule summaries when the config option
91 status.submoduleSummary is set).
92
93 --ignored[=<mode>]
94 Show ignored files as well.
95
96 The mode parameter is used to specify the handling of ignored
97 files. It is optional: it defaults to traditional.
98
99 The possible options are:
100
101 · traditional - Shows ignored files and directories, unless
102 --untracked-files=all is specifed, in which case individual
103 files in ignored directories are displayed.
104
105 · no - Show no ignored files.
106
107 · matching - Shows ignored files and directories matching an
108 ignore pattern.
109
110 When matching mode is specified, paths that explicitly match an
111 ignored pattern are shown. If a directory matches an ignore
112 pattern, then it is shown, but not paths contained in the
113 ignored directory. If a directory does not match an ignore
114 pattern, but all contents are ignored, then the directory is
115 not shown, but all contents are shown.
116
117 -z
118 Terminate entries with NUL, instead of LF. This implies the
119 --porcelain=v1 output format if no other format is given.
120
121 --column[=<options>], --no-column
122 Display untracked files in columns. See configuration variable
123 column.status for option syntax.--column and --no-column without
124 options are equivalent to always and never respectively.
125
126 --ahead-behind, --no-ahead-behind
127 Display or do not display detailed ahead/behind counts for the
128 branch relative to its upstream branch. Defaults to true.
129
130 --renames, --no-renames
131 Turn on/off rename detection regardless of user configuration. See
132 also git-diff(1) --no-renames.
133
134 --find-renames[=<n>]
135 Turn on rename detection, optionally setting the similarity
136 threshold. See also git-diff(1) --find-renames.
137
138 <pathspec>...
139 See the pathspec entry in gitglossary(7).
140
142 The output from this command is designed to be used as a commit
143 template comment. The default, long format, is designed to be human
144 readable, verbose and descriptive. Its contents and format are subject
145 to change at any time.
146
147 The paths mentioned in the output, unlike many other Git commands, are
148 made relative to the current directory if you are working in a
149 subdirectory (this is on purpose, to help cutting and pasting). See the
150 status.relativePaths config option below.
151
152 Short Format
153 In the short-format, the status of each path is shown as one of these
154 forms
155
156 XY PATH
157 XY ORIG_PATH -> PATH
158
159 where ORIG_PATH is where the renamed/copied contents came from.
160 ORIG_PATH is only shown when the entry is renamed or copied. The XY is
161 a two-letter status code.
162
163 The fields (including the ->) are separated from each other by a single
164 space. If a filename contains whitespace or other nonprintable
165 characters, that field will be quoted in the manner of a C string
166 literal: surrounded by ASCII double quote (34) characters, and with
167 interior special characters backslash-escaped.
168
169 For paths with merge conflicts, X and Y show the modification states of
170 each side of the merge. For paths that do not have merge conflicts, X
171 shows the status of the index, and Y shows the status of the work tree.
172 For untracked paths, XY are ??. Other status codes can be interpreted
173 as follows:
174
175 · ' ' = unmodified
176
177 · M = modified
178
179 · A = added
180
181 · D = deleted
182
183 · R = renamed
184
185 · C = copied
186
187 · U = updated but unmerged
188
189 Ignored files are not listed, unless --ignored option is in effect, in
190 which case XY are !!.
191
192 X Y Meaning
193 -------------------------------------------------
194 [AMD] not updated
195 M [ MD] updated in index
196 A [ MD] added to index
197 D deleted from index
198 R [ MD] renamed in index
199 C [ MD] copied in index
200 [MARC] index and work tree matches
201 [ MARC] M work tree changed since index
202 [ MARC] D deleted in work tree
203 [ D] R renamed in work tree
204 [ D] C copied in work tree
205 -------------------------------------------------
206 D D unmerged, both deleted
207 A U unmerged, added by us
208 U D unmerged, deleted by them
209 U A unmerged, added by them
210 D U unmerged, deleted by us
211 A A unmerged, both added
212 U U unmerged, both modified
213 -------------------------------------------------
214 ? ? untracked
215 ! ! ignored
216 -------------------------------------------------
217
218 Submodules have more state and instead report M the submodule has a
219 different HEAD than recorded in the index m the submodule has modified
220 content ? the submodule has untracked files since modified content or
221 untracked files in a submodule cannot be added via git add in the
222 superproject to prepare a commit.
223
224 m and ? are applied recursively. For example if a nested submodule in a
225 submodule contains an untracked file, this is reported as ? as well.
226
227 If -b is used the short-format status is preceded by a line
228
229 ## branchname tracking info
230
231 Porcelain Format Version 1
232 Version 1 porcelain format is similar to the short format, but is
233 guaranteed not to change in a backwards-incompatible way between Git
234 versions or based on user configuration. This makes it ideal for
235 parsing by scripts. The description of the short format above also
236 describes the porcelain format, with a few exceptions:
237
238 1. The user’s color.status configuration is not respected; color will
239 always be off.
240
241 2. The user’s status.relativePaths configuration is not respected;
242 paths shown will always be relative to the repository root.
243
244 There is also an alternate -z format recommended for machine parsing.
245 In that format, the status field is the same, but some other things
246 change. First, the -> is omitted from rename entries and the field
247 order is reversed (e.g from -> to becomes to from). Second, a NUL
248 (ASCII 0) follows each filename, replacing space as a field separator
249 and the terminating newline (but a space still separates the status
250 field from the first filename). Third, filenames containing special
251 characters are not specially formatted; no quoting or
252 backslash-escaping is performed.
253
254 Any submodule changes are reported as modified M instead of m or single
255 ?.
256
257 Porcelain Format Version 2
258 Version 2 format adds more detailed information about the state of the
259 worktree and changed items. Version 2 also defines an extensible set of
260 easy to parse optional headers.
261
262 Header lines start with "#" and are added in response to specific
263 command line arguments. Parsers should ignore headers they don’t
264 recognize.
265
266 # Branch Headers
267
268 If --branch is given, a series of header lines are printed with
269 information about the current branch.
270
271 Line Notes
272 ------------------------------------------------------------
273 # branch.oid <commit> | (initial) Current commit.
274 # branch.head <branch> | (detached) Current branch.
275 # branch.upstream <upstream_branch> If upstream is set.
276 # branch.ab +<ahead> -<behind> If upstream is set and
277 the commit is present.
278 ------------------------------------------------------------
279
280 # Changed Tracked Entries
281
282 Following the headers, a series of lines are printed for tracked
283 entries. One of three different line formats may be used to describe an
284 entry depending on the type of change. Tracked entries are printed in
285 an undefined order; parsers should allow for a mixture of the 3 line
286 types in any order.
287
288 Ordinary changed entries have the following format:
289
290 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
291
292 Renamed or copied entries have the following format:
293
294 2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
295
296 Field Meaning
297 --------------------------------------------------------
298 <XY> A 2 character field containing the staged and
299 unstaged XY values described in the short format,
300 with unchanged indicated by a "." rather than
301 a space.
302 <sub> A 4 character field describing the submodule state.
303 "N..." when the entry is not a submodule.
304 "S<c><m><u>" when the entry is a submodule.
305 <c> is "C" if the commit changed; otherwise ".".
306 <m> is "M" if it has tracked changes; otherwise ".".
307 <u> is "U" if there are untracked changes; otherwise ".".
308 <mH> The octal file mode in HEAD.
309 <mI> The octal file mode in the index.
310 <mW> The octal file mode in the worktree.
311 <hH> The object name in HEAD.
312 <hI> The object name in the index.
313 <X><score> The rename or copy score (denoting the percentage
314 of similarity between the source and target of the
315 move or copy). For example "R100" or "C75".
316 <path> The pathname. In a renamed/copied entry, this
317 is the target path.
318 <sep> When the `-z` option is used, the 2 pathnames are separated
319 with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
320 byte separates them.
321 <origPath> The pathname in the commit at HEAD or in the index.
322 This is only present in a renamed/copied entry, and
323 tells where the renamed/copied contents came from.
324 --------------------------------------------------------
325
326 Unmerged entries have the following format; the first character is a
327 "u" to distinguish from ordinary changed entries.
328
329 u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
330
331 Field Meaning
332 --------------------------------------------------------
333 <XY> A 2 character field describing the conflict type
334 as described in the short format.
335 <sub> A 4 character field describing the submodule state
336 as described above.
337 <m1> The octal file mode in stage 1.
338 <m2> The octal file mode in stage 2.
339 <m3> The octal file mode in stage 3.
340 <mW> The octal file mode in the worktree.
341 <h1> The object name in stage 1.
342 <h2> The object name in stage 2.
343 <h3> The object name in stage 3.
344 <path> The pathname.
345 --------------------------------------------------------
346
347 # Other Items
348
349 Following the tracked entries (and if requested), a series of lines
350 will be printed for untracked and then ignored items found in the
351 worktree.
352
353 Untracked items have the following format:
354
355 ? <path>
356
357 Ignored items have the following format:
358
359 ! <path>
360
361 # Pathname Format Notes and -z
362
363 When the -z option is given, pathnames are printed as is and without
364 any quoting and lines are terminated with a NUL (ASCII 0x00) byte.
365
366 Without the -z option, pathnames with "unusual" characters are quoted
367 as explained for the configuration variable core.quotePath (see git-
368 config(1)).
369
371 The command honors color.status (or status.color — they mean the same
372 thing and the latter is kept for backward compatibility) and
373 color.status.<slot> configuration variables to colorize its output.
374
375 If the config variable status.relativePaths is set to false, then all
376 paths shown are relative to the repository root, not to the current
377 directory.
378
379 If status.submoduleSummary is set to a non zero number or true
380 (identical to -1 or an unlimited number), the submodule summary will be
381 enabled for the long format and a summary of commits for modified
382 submodules will be shown (see --summary-limit option of git-
383 submodule(1)). Please note that the summary output from the status
384 command will be suppressed for all submodules when
385 diff.ignoreSubmodules is set to all or only for those submodules where
386 submodule.<name>.ignore=all. To also view the summary for ignored
387 submodules you can either use the --ignore-submodules=dirty command
388 line option or the git submodule summary command, which shows a similar
389 output but does not honor these settings.
390
392 By default, git status will automatically refresh the index, updating
393 the cached stat information from the working tree and writing out the
394 result. Writing out the updated index is an optimization that isn’t
395 strictly necessary (status computes the values for itself, but writing
396 them out is just to save subsequent programs from repeating our
397 computation). When status is run in the background, the lock held
398 during the write may conflict with other simultaneous processes,
399 causing them to fail. Scripts running status in the background should
400 consider using git --no-optional-locks status (see git(1) for details).
401
403 gitignore(5)
404
406 Part of the git(1) suite
407
408
409
410Git 2.18.1 05/14/2019 GIT-STATUS(1)