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