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 • A = added
197
198 • D = deleted
199
200 • R = renamed
201
202 • C = copied
203
204 • U = updated but unmerged
205
206 X Y Meaning
207 -------------------------------------------------
208 [AMD] not updated
209 M [ MD] updated in index
210 A [ MD] added to index
211 D deleted from index
212 R [ MD] renamed in index
213 C [ MD] copied in index
214 [MARC] index and work tree matches
215 [ MARC] M work tree changed since index
216 [ MARC] D deleted in work tree
217 [ D] R renamed in work tree
218 [ D] C copied in work tree
219 -------------------------------------------------
220 D D unmerged, both deleted
221 A U unmerged, added by us
222 U D unmerged, deleted by them
223 U A unmerged, added by them
224 D U unmerged, deleted by us
225 A A unmerged, both added
226 U U unmerged, both modified
227 -------------------------------------------------
228 ? ? untracked
229 ! ! ignored
230 -------------------------------------------------
231
232 Submodules have more state and instead report M the submodule has a
233 different HEAD than recorded in the index m the submodule has modified
234 content ? the submodule has untracked files since modified content or
235 untracked files in a submodule cannot be added via git add in the
236 superproject to prepare a commit.
237
238 m and ? are applied recursively. For example if a nested submodule in a
239 submodule contains an untracked file, this is reported as ? as well.
240
241 If -b is used the short-format status is preceded by a line
242
243 ## branchname tracking info
244
245 Porcelain Format Version 1
246 Version 1 porcelain format is similar to the short format, but is
247 guaranteed not to change in a backwards-incompatible way between Git
248 versions or based on user configuration. This makes it ideal for
249 parsing by scripts. The description of the short format above also
250 describes the porcelain format, with a few exceptions:
251
252 1. The user’s color.status configuration is not respected; color will
253 always be off.
254
255 2. The user’s status.relativePaths configuration is not respected;
256 paths shown will always be relative to the repository root.
257
258 There is also an alternate -z format recommended for machine parsing.
259 In that format, the status field is the same, but some other things
260 change. First, the -> is omitted from rename entries and the field
261 order is reversed (e.g from -> to becomes to from). Second, a NUL
262 (ASCII 0) follows each filename, replacing space as a field separator
263 and the terminating newline (but a space still separates the status
264 field from the first filename). Third, filenames containing special
265 characters are not specially formatted; no quoting or
266 backslash-escaping is performed.
267
268 Any submodule changes are reported as modified M instead of m or single
269 ?.
270
271 Porcelain Format Version 2
272 Version 2 format adds more detailed information about the state of the
273 worktree and changed items. Version 2 also defines an extensible set of
274 easy to parse optional headers.
275
276 Header lines start with "#" and are added in response to specific
277 command line arguments. Parsers should ignore headers they don’t
278 recognize.
279
280 Branch Headers
281 If --branch is given, a series of header lines are printed with
282 information about the current branch.
283
284 Line Notes
285 ------------------------------------------------------------
286 # branch.oid <commit> | (initial) Current commit.
287 # branch.head <branch> | (detached) Current branch.
288 # branch.upstream <upstream_branch> If upstream is set.
289 # branch.ab +<ahead> -<behind> If upstream is set and
290 the commit is present.
291 ------------------------------------------------------------
292
293 Changed Tracked Entries
294 Following the headers, a series of lines are printed for tracked
295 entries. One of three different line formats may be used to
296 describe an entry depending on the type of change. Tracked entries
297 are printed in an undefined order; parsers should allow for a
298 mixture of the 3 line types in any order.
299
300 Ordinary changed entries have the following format:
301
302 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
303
304 Renamed or copied entries have the following format:
305
306 2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
307
308 Field Meaning
309 --------------------------------------------------------
310 <XY> A 2 character field containing the staged and
311 unstaged XY values described in the short format,
312 with unchanged indicated by a "." rather than
313 a space.
314 <sub> A 4 character field describing the submodule state.
315 "N..." when the entry is not a submodule.
316 "S<c><m><u>" when the entry is a submodule.
317 <c> is "C" if the commit changed; otherwise ".".
318 <m> is "M" if it has tracked changes; otherwise ".".
319 <u> is "U" if there are untracked changes; otherwise ".".
320 <mH> The octal file mode in HEAD.
321 <mI> The octal file mode in the index.
322 <mW> The octal file mode in the worktree.
323 <hH> The object name in HEAD.
324 <hI> The object name in the index.
325 <X><score> The rename or copy score (denoting the percentage
326 of similarity between the source and target of the
327 move or copy). For example "R100" or "C75".
328 <path> The pathname. In a renamed/copied entry, this
329 is the target path.
330 <sep> When the `-z` option is used, the 2 pathnames are separated
331 with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
332 byte separates them.
333 <origPath> The pathname in the commit at HEAD or in the index.
334 This is only present in a renamed/copied entry, and
335 tells where the renamed/copied contents came from.
336 --------------------------------------------------------
337
338 Unmerged entries have the following format; the first character is
339 a "u" to distinguish from ordinary changed entries.
340
341 u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
342
343 Field Meaning
344 --------------------------------------------------------
345 <XY> A 2 character field describing the conflict type
346 as described in the short format.
347 <sub> A 4 character field describing the submodule state
348 as described above.
349 <m1> The octal file mode in stage 1.
350 <m2> The octal file mode in stage 2.
351 <m3> The octal file mode in stage 3.
352 <mW> The octal file mode in the worktree.
353 <h1> The object name in stage 1.
354 <h2> The object name in stage 2.
355 <h3> The object name in stage 3.
356 <path> The pathname.
357 --------------------------------------------------------
358
359 Other Items
360 Following the tracked entries (and if requested), a series of lines
361 will be printed for untracked and then ignored items found in the
362 worktree.
363
364 Untracked items have the following format:
365
366 ? <path>
367
368 Ignored items have the following format:
369
370 ! <path>
371
372 Pathname Format Notes and -z
373 When the -z option is given, pathnames are printed as is and
374 without any quoting and lines are terminated with a NUL (ASCII
375 0x00) byte.
376
377 Without the -z option, pathnames with "unusual" characters are
378 quoted as explained for the configuration variable core.quotePath
379 (see git-config(1)).
380
382 The command honors color.status (or status.color — they mean the same
383 thing and the latter is kept for backward compatibility) and
384 color.status.<slot> configuration variables to colorize its output.
385
386 If the config variable status.relativePaths is set to false, then all
387 paths shown are relative to the repository root, not to the current
388 directory.
389
390 If status.submoduleSummary is set to a non zero number or true
391 (identical to -1 or an unlimited number), the submodule summary will be
392 enabled for the long format and a summary of commits for modified
393 submodules will be shown (see --summary-limit option of git-
394 submodule(1)). Please note that the summary output from the status
395 command will be suppressed for all submodules when
396 diff.ignoreSubmodules is set to all or only for those submodules where
397 submodule.<name>.ignore=all. To also view the summary for ignored
398 submodules you can either use the --ignore-submodules=dirty command
399 line option or the git submodule summary command, which shows a similar
400 output but does not honor these settings.
401
403 By default, git status will automatically refresh the index, updating
404 the cached stat information from the working tree and writing out the
405 result. Writing out the updated index is an optimization that isn’t
406 strictly necessary (status computes the values for itself, but writing
407 them out is just to save subsequent programs from repeating our
408 computation). When status is run in the background, the lock held
409 during the write may conflict with other simultaneous processes,
410 causing them to fail. Scripts running status in the background should
411 consider using git --no-optional-locks status (see git(1) for details).
412
414 gitignore(5)
415
417 Part of the git(1) suite
418
419
420
421Git 2.31.1 2021-03-26 GIT-STATUS(1)