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