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 work
67 to find untracked files in the filesystem, this mode may take some
68 time in a large working tree. Consider enabling untracked cache and
69 split index if supported (see git update-index --untracked-cache
70 and git update-index --split-index), Otherwise you can use no to
71 have git status return more quickly without showing untracked
72 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 specified, 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 ignored
113 directory. If a directory does not match an ignore pattern, but all
114 contents are ignored, then the directory is not shown, but all
115 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 If --branch is given, a series of header lines are printed with
268 information about the current branch.
269
270 Line Notes
271 ------------------------------------------------------------
272 # branch.oid <commit> | (initial) Current commit.
273 # branch.head <branch> | (detached) Current branch.
274 # branch.upstream <upstream_branch> If upstream is set.
275 # branch.ab +<ahead> -<behind> If upstream is set and
276 the commit is present.
277 ------------------------------------------------------------
278
279 Changed Tracked Entries
280 Following the headers, a series of lines are printed for tracked
281 entries. One of three different line formats may be used to
282 describe an entry depending on the type of change. Tracked entries
283 are printed in an undefined order; parsers should allow for a
284 mixture of the 3 line types in any order.
285
286 Ordinary changed entries have the following format:
287
288 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
289
290 Renamed or copied entries have the following format:
291
292 2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
293
294 Field Meaning
295 --------------------------------------------------------
296 <XY> A 2 character field containing the staged and
297 unstaged XY values described in the short format,
298 with unchanged indicated by a "." rather than
299 a space.
300 <sub> A 4 character field describing the submodule state.
301 "N..." when the entry is not a submodule.
302 "S<c><m><u>" when the entry is a submodule.
303 <c> is "C" if the commit changed; otherwise ".".
304 <m> is "M" if it has tracked changes; otherwise ".".
305 <u> is "U" if there are untracked changes; otherwise ".".
306 <mH> The octal file mode in HEAD.
307 <mI> The octal file mode in the index.
308 <mW> The octal file mode in the worktree.
309 <hH> The object name in HEAD.
310 <hI> The object name in the index.
311 <X><score> The rename or copy score (denoting the percentage
312 of similarity between the source and target of the
313 move or copy). For example "R100" or "C75".
314 <path> The pathname. In a renamed/copied entry, this
315 is the target path.
316 <sep> When the `-z` option is used, the 2 pathnames are separated
317 with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
318 byte separates them.
319 <origPath> The pathname in the commit at HEAD or in the index.
320 This is only present in a renamed/copied entry, and
321 tells where the renamed/copied contents came from.
322 --------------------------------------------------------
323
324 Unmerged entries have the following format; the first character is
325 a "u" to distinguish from ordinary changed entries.
326
327 u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
328
329 Field Meaning
330 --------------------------------------------------------
331 <XY> A 2 character field describing the conflict type
332 as described in the short format.
333 <sub> A 4 character field describing the submodule state
334 as described above.
335 <m1> The octal file mode in stage 1.
336 <m2> The octal file mode in stage 2.
337 <m3> The octal file mode in stage 3.
338 <mW> The octal file mode in the worktree.
339 <h1> The object name in stage 1.
340 <h2> The object name in stage 2.
341 <h3> The object name in stage 3.
342 <path> The pathname.
343 --------------------------------------------------------
344
345 Other Items
346 Following the tracked entries (and if requested), a series of lines
347 will be printed for untracked and then ignored items found in the
348 worktree.
349
350 Untracked items have the following format:
351
352 ? <path>
353
354 Ignored items have the following format:
355
356 ! <path>
357
358 Pathname Format Notes and -z
359 When the -z option is given, pathnames are printed as is and
360 without any quoting and lines are terminated with a NUL (ASCII
361 0x00) byte.
362
363 Without the -z option, pathnames with "unusual" characters are
364 quoted as explained for the configuration variable core.quotePath
365 (see git-config(1)).
366
368 The command honors color.status (or status.color — they mean the same
369 thing and the latter is kept for backward compatibility) and
370 color.status.<slot> configuration variables to colorize its output.
371
372 If the config variable status.relativePaths is set to false, then all
373 paths shown are relative to the repository root, not to the current
374 directory.
375
376 If status.submoduleSummary is set to a non zero number or true
377 (identical to -1 or an unlimited number), the submodule summary will be
378 enabled for the long format and a summary of commits for modified
379 submodules will be shown (see --summary-limit option of git-
380 submodule(1)). Please note that the summary output from the status
381 command will be suppressed for all submodules when
382 diff.ignoreSubmodules is set to all or only for those submodules where
383 submodule.<name>.ignore=all. To also view the summary for ignored
384 submodules you can either use the --ignore-submodules=dirty command
385 line option or the git submodule summary command, which shows a similar
386 output but does not honor these settings.
387
389 By default, git status will automatically refresh the index, updating
390 the cached stat information from the working tree and writing out the
391 result. Writing out the updated index is an optimization that isn’t
392 strictly necessary (status computes the values for itself, but writing
393 them out is just to save subsequent programs from repeating our
394 computation). When status is run in the background, the lock held
395 during the write may conflict with other simultaneous processes,
396 causing them to fail. Scripts running status in the background should
397 consider using git --no-optional-locks status (see git(1) for details).
398
400 gitignore(5)
401
403 Part of the git(1) suite
404
405
406
407Git 2.24.1 12/10/2019 GIT-STATUS(1)