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