blob: 725065ef2d7b6b3c7c6c29a434a8996a7e1ae559 [file] [log] [blame]
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001git-status(1)
2=============
Junio C Hamano3f971fc2005-08-14 17:24:36 -07003
4NAME
5----
Junio C Hamanoc3f0baa2007-01-18 15:53:37 -08006git-status - Show the working tree status
Junio C Hamano3f971fc2005-08-14 17:24:36 -07007
8
9SYNOPSIS
10--------
Martin von Zweigbergk7791a1d2011-07-01 22:38:26 -040011[verse]
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070012'git status' [<options>...] [--] [<pathspec>...]
Junio C Hamano3f971fc2005-08-14 17:24:36 -070013
14DESCRIPTION
15-----------
Jeff King2099bca2007-12-08 04:00:31 -050016Displays paths that have differences between the index file and the
17current HEAD commit, paths that have differences between the working
18tree and the index file, and paths in the working tree that are not
Thomas Ackermann2de9b712013-01-21 20:17:53 +010019tracked by Git (and are not ignored by linkgit:gitignore[5]). The first
Jeff King2099bca2007-12-08 04:00:31 -050020are what you _would_ commit by running `git commit`; the second and
Thomas Rast0b444cd2010-01-10 00:33:00 +010021third are what you _could_ commit by running 'git add' before running
Jeff King2099bca2007-12-08 04:00:31 -050022`git commit`.
Junio C Hamano3f971fc2005-08-14 17:24:36 -070023
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070024OPTIONS
25-------
Junio C Hamanofb6ff942006-08-07 22:41:32 -070026
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070027-s::
28--short::
29 Give the output in the short-format.
30
Michael J Gruber46077fa2010-05-25 16:52:03 +020031-b::
32--branch::
33 Show the branch and tracking info even in short-format.
34
Jeff Hostetlerc4f596b2016-08-05 18:00:28 -040035--porcelain[=<version>]::
Jeff Kingfc17df02011-05-26 22:31:51 -040036 Give the output in an easy-to-parse format for scripts.
37 This is similar to the short output, but will remain stable
Thomas Ackermann2de9b712013-01-21 20:17:53 +010038 across Git versions and regardless of user configuration. See
Jeff Kingfc17df02011-05-26 22:31:51 -040039 below for details.
Jeff Hostetlerc4f596b2016-08-05 18:00:28 -040040+
41The version parameter is used to specify the format version.
42This is optional and defaults to the original version 'v1' format.
Jeff King6f157872009-09-05 04:55:37 -040043
Jeff Kingf3f47a12012-10-18 21:15:50 +070044--long::
45 Give the output in the long-format. This is the default.
46
Michael Haggerty9c589d92015-04-23 14:27:46 +020047-v::
48--verbose::
49 In addition to the names of files that have been changed, also
50 show the textual changes that are staged to be committed
51 (i.e., like the output of `git diff --cached`). If `-v` is specified
52 twice, then also show the changes in the working tree that
53 have not yet been staged (i.e., like the output of `git diff`).
54
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070055-u[<mode>]::
56--untracked-files[=<mode>]::
Clemens Buchacher4cc62602011-02-21 21:05:25 +010057 Show untracked files.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070058+
Matthieu Moy2b594bf2015-09-19 09:47:50 +020059The mode parameter is used to specify the handling of untracked files.
60It is optional: it defaults to 'all', and if specified, it must be
61stuck to the option (e.g. `-uno`, but not `-u no`).
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070062+
Clemens Buchacher4cc62602011-02-21 21:05:25 +010063The possible options are:
64+
Junio C Hamano5823eb22013-03-15 09:53:48 -070065 - 'no' - Show no untracked files.
66 - 'normal' - Shows untracked files and directories.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070067 - 'all' - Also shows individual files in untracked directories.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070068+
Junio C Hamano5823eb22013-03-15 09:53:48 -070069When `-u` option is not used, untracked files and directories are
70shown (i.e. the same as specifying `normal`), to help you avoid
71forgetting to add newly created files. Because it takes extra work
72to find untracked files in the filesystem, this mode may take some
Nguyễn Thái Ngọc Duyaeb6f8b2015-03-08 17:12:47 +070073time in a large working tree.
74Consider enabling untracked cache and split index if supported (see
75`git update-index --untracked-cache` and `git update-index
76--split-index`), Otherwise you can use `no` to have `git status`
Junio C Hamano5823eb22013-03-15 09:53:48 -070077return more quickly without showing untracked files.
78+
Clemens Buchacher4cc62602011-02-21 21:05:25 +010079The default can be changed using the status.showUntrackedFiles
80configuration variable documented in linkgit:git-config[1].
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -070081
Jens Lehmann46a958b2010-06-25 16:56:47 +020082--ignore-submodules[=<when>]::
83 Ignore changes to submodules when looking for changes. <when> can be
Jens Lehmannaee9c7d2010-08-06 00:39:25 +020084 either "none", "untracked", "dirty" or "all", which is the default.
85 Using "none" will consider the submodule modified when it either contains
86 untracked or modified files or its HEAD differs from the commit recorded
87 in the superproject and can be used to override any settings of the
Jens Lehmann302ad7a2010-08-06 00:40:48 +020088 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
Jens Lehmann46a958b2010-06-25 16:56:47 +020089 "untracked" is used submodules are not considered dirty when they only
90 contain untracked content (but they are still scanned for modified
91 content). Using "dirty" ignores all changes to the work tree of submodules,
92 only changes to the commits stored in the superproject are shown (this was
93 the behavior before 1.7.0). Using "all" hides all changes to submodules
94 (and suppresses the output of submodule summaries when the config option
Nguyễn Thái Ngọc Duyda0005b2015-03-11 16:32:45 -040095 `status.submoduleSummary` is set).
Jens Lehmann46a958b2010-06-25 16:56:47 +020096
Junio C Hamano150b4932011-06-02 09:07:11 -070097--ignored::
98 Show ignored files as well.
99
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700100-z::
Jeff King6f157872009-09-05 04:55:37 -0400101 Terminate entries with NUL, instead of LF. This implies
Jeff Hostetlerc4f596b2016-08-05 18:00:28 -0400102 the `--porcelain=v1` output format if no other format is given.
Jeff King2099bca2007-12-08 04:00:31 -0500103
Nguyễn Thái Ngọc Duy323d0532012-04-13 17:54:39 +0700104--column[=<options>]::
105--no-column::
106 Display untracked files in columns. See configuration variable
107 column.status for option syntax.`--column` and `--no-column`
108 without options are equivalent to 'always' and 'never'
109 respectively.
110
Junio C Hamano3f971fc2005-08-14 17:24:36 -0700111
112OUTPUT
113------
114The output from this command is designed to be used as a commit
Dirk Wallenstein22d55ae2014-03-21 15:10:18 +0100115template comment.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700116The default, long format, is designed to be human readable,
Jeff King043b5cd2011-05-26 22:31:11 -0400117verbose and descriptive. Its contents and format are subject to change
118at any time.
Junio C Hamano3f971fc2005-08-14 17:24:36 -0700119
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100120The paths mentioned in the output, unlike many other Git commands, are
Jeff King2099bca2007-12-08 04:00:31 -0500121made relative to the current directory if you are working in a
Jeff King46f721c2007-12-07 16:26:07 -0500122subdirectory (this is on purpose, to help cutting and pasting). See
123the status.relativePaths config option below.
Junio C Hamanoc7860502007-12-06 09:15:39 -0800124
Jeff Kingfc17df02011-05-26 22:31:51 -0400125Short Format
126~~~~~~~~~~~~
127
Jeff King043b5cd2011-05-26 22:31:11 -0400128In the short-format, the status of each path is shown as
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700129
130 XY PATH1 -> PATH2
131
Jeff King6cf378f2012-04-26 04:51:57 -0400132where `PATH1` is the path in the `HEAD`, and the " `-> PATH2`" part is
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700133shown only when `PATH1` corresponds to a different path in the
Philip Oakley7c45cee2014-10-19 15:17:15 +0100134index/worktree (i.e. the file is renamed). The `XY` is a two-letter
Eric Raymonde92e9cd2010-04-23 13:40:15 -0400135status code.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700136
Jeff King6cf378f2012-04-26 04:51:57 -0400137The fields (including the `->`) are separated from each other by a
Eric Raymonde92e9cd2010-04-23 13:40:15 -0400138single space. If a filename contains whitespace or other nonprintable
139characters, that field will be quoted in the manner of a C string
140literal: surrounded by ASCII double quote (34) characters, and with
141interior special characters backslash-escaped.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700142
Philip Oakley7c45cee2014-10-19 15:17:15 +0100143For paths with merge conflicts, `X` and `Y` show the modification
Eric Raymonde92e9cd2010-04-23 13:40:15 -0400144states of each side of the merge. For paths that do not have merge
145conflicts, `X` shows the status of the index, and `Y` shows the status
146of the work tree. For untracked paths, `XY` are `??`. Other status
147codes can be interpreted as follows:
148
149* ' ' = unmodified
150* 'M' = modified
151* 'A' = added
152* 'D' = deleted
153* 'R' = renamed
154* 'C' = copied
155* 'U' = updated but unmerged
156
Junio C Hamano50cebda2011-06-29 17:03:12 -0700157Ignored files are not listed, unless `--ignored` option is in effect,
158in which case `XY` are `!!`.
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700159
160 X Y Meaning
161 -------------------------------------------------
162 [MD] not updated
163 M [ MD] updated in index
164 A [ MD] added to index
Eric Raymonde92e9cd2010-04-23 13:40:15 -0400165 D [ M] deleted from index
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700166 R [ MD] renamed in index
167 C [ MD] copied in index
168 [MARC] index and work tree matches
169 [ MARC] M work tree changed since index
170 [ MARC] D deleted in work tree
171 -------------------------------------------------
172 D D unmerged, both deleted
173 A U unmerged, added by us
174 U D unmerged, deleted by them
175 U A unmerged, added by them
176 D U unmerged, deleted by us
177 A A unmerged, both added
178 U U unmerged, both modified
179 -------------------------------------------------
180 ? ? untracked
Junio C Hamano150b4932011-06-02 09:07:11 -0700181 ! ! ignored
Junio C Hamano9e4b7ab2009-08-15 02:27:39 -0700182 -------------------------------------------------
183
Michael J Gruber46077fa2010-05-25 16:52:03 +0200184If -b is used the short-format status is preceded by a line
185
Jeff Hostetler1cd828d2016-08-11 10:46:00 -0400186 ## branchname tracking info
Michael J Gruber46077fa2010-05-25 16:52:03 +0200187
Jeff Hostetler1cd828d2016-08-11 10:46:00 -0400188Porcelain Format Version 1
189~~~~~~~~~~~~~~~~~~~~~~~~~~
Jeff Kingfc17df02011-05-26 22:31:51 -0400190
Jeff Hostetler1cd828d2016-08-11 10:46:00 -0400191Version 1 porcelain format is similar to the short format, but is guaranteed
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100192not to change in a backwards-incompatible way between Git versions or
Jeff Kingfc17df02011-05-26 22:31:51 -0400193based on user configuration. This makes it ideal for parsing by scripts.
194The description of the short format above also describes the porcelain
195format, with a few exceptions:
196
1971. The user's color.status configuration is not respected; color will
198 always be off.
199
2002. The user's status.relativePaths configuration is not respected; paths
201 shown will always be relative to the repository root.
202
203There is also an alternate -z format recommended for machine parsing. In
Eric Raymonde92e9cd2010-04-23 13:40:15 -0400204that format, the status field is the same, but some other things
Jeff King715e7162011-05-26 22:32:41 -0400205change. First, the '\->' is omitted from rename entries and the field
206order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL
Eric Raymonde92e9cd2010-04-23 13:40:15 -0400207(ASCII 0) follows each filename, replacing space as a field separator
208and the terminating newline (but a space still separates the status
209field from the first filename). Third, filenames containing special
210characters are not specially formatted; no quoting or
Jeff Kingd4a6bf12012-05-07 17:09:04 -0400211backslash-escaping is performed.
Junio C Hamano3f971fc2005-08-14 17:24:36 -0700212
Jeff Hostetler1cd828d2016-08-11 10:46:00 -0400213Porcelain Format Version 2
214~~~~~~~~~~~~~~~~~~~~~~~~~~
215
216Version 2 format adds more detailed information about the state of
217the worktree and changed items. Version 2 also defines an extensible
218set of easy to parse optional headers.
219
220Header lines start with "#" and are added in response to specific
221command line arguments. Parsers should ignore headers they
222don't recognize.
223
224### Branch Headers
225
226If `--branch` is given, a series of header lines are printed with
227information about the current branch.
228
229 Line Notes
230 ------------------------------------------------------------
231 # branch.oid <commit> | (initial) Current commit.
232 # branch.head <branch> | (detached) Current branch.
233 # branch.upstream <upstream_branch> If upstream is set.
234 # branch.ab +<ahead> -<behind> If upstream is set and
235 the commit is present.
236 ------------------------------------------------------------
237
238### Changed Tracked Entries
239
240Following the headers, a series of lines are printed for tracked
241entries. One of three different line formats may be used to describe
242an entry depending on the type of change. Tracked entries are printed
243in an undefined order; parsers should allow for a mixture of the 3
244line types in any order.
245
246Ordinary changed entries have the following format:
247
248 1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
249
250Renamed or copied entries have the following format:
251
252 2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
253
254 Field Meaning
255 --------------------------------------------------------
256 <XY> A 2 character field containing the staged and
257 unstaged XY values described in the short format,
258 with unchanged indicated by a "." rather than
259 a space.
260 <sub> A 4 character field describing the submodule state.
261 "N..." when the entry is not a submodule.
262 "S<c><m><u>" when the entry is a submodule.
263 <c> is "C" if the commit changed; otherwise ".".
264 <m> is "M" if it has tracked changes; otherwise ".".
265 <u> is "U" if there are untracked changes; otherwise ".".
266 <mH> The octal file mode in HEAD.
267 <mI> The octal file mode in the index.
268 <mW> The octal file mode in the worktree.
269 <hH> The object name in HEAD.
270 <hI> The object name in the index.
271 <X><score> The rename or copy score (denoting the percentage
272 of similarity between the source and target of the
273 move or copy). For example "R100" or "C75".
274 <path> The pathname. In a renamed/copied entry, this
275 is the path in the index and in the working tree.
276 <sep> When the `-z` option is used, the 2 pathnames are separated
277 with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
278 byte separates them.
279 <origPath> The pathname in the commit at HEAD. This is only
280 present in a renamed/copied entry, and tells
281 where the renamed/copied contents came from.
282 --------------------------------------------------------
283
284Unmerged entries have the following format; the first character is
285a "u" to distinguish from ordinary changed entries.
286
287 u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
288
289 Field Meaning
290 --------------------------------------------------------
291 <XY> A 2 character field describing the conflict type
292 as described in the short format.
293 <sub> A 4 character field describing the submodule state
294 as described above.
295 <m1> The octal file mode in stage 1.
296 <m2> The octal file mode in stage 2.
297 <m3> The octal file mode in stage 3.
298 <mW> The octal file mode in the worktree.
299 <h1> The object name in stage 1.
300 <h2> The object name in stage 2.
301 <h3> The object name in stage 3.
302 <path> The pathname.
303 --------------------------------------------------------
304
305### Other Items
306
307Following the tracked entries (and if requested), a series of
308lines will be printed for untracked and then ignored items
309found in the worktree.
310
311Untracked items have the following format:
312
313 ? <path>
314
315Ignored items have the following format:
316
317 ! <path>
318
319### Pathname Format Notes and -z
320
321When the `-z` option is given, pathnames are printed as is and
322without any quoting and lines are terminated with a NUL (ASCII 0x00)
323byte.
324
325Otherwise, all pathnames will be "C-quoted" if they contain any tab,
326linefeed, double quote, or backslash characters. In C-quoting, these
327characters will be replaced with the corresponding C-style escape
328sequences and the resulting pathname will be double quoted.
329
330
Junio C Hamano31fcd632007-01-17 01:11:01 -0800331CONFIGURATION
332-------------
333
334The command honors `color.status` (or `status.color` -- they
335mean the same thing and the latter is kept for backward
336compatibility) and `color.status.<slot>` configuration variables
337to colorize its output.
338
Jeff King46f721c2007-12-07 16:26:07 -0500339If the config variable `status.relativePaths` is set to false, then all
Michael J Gruber482a6c12009-11-26 16:24:38 +0100340paths shown are relative to the repository root, not to the current
341directory.
Jeff King46f721c2007-12-07 16:26:07 -0500342
Nguyễn Thái Ngọc Duyda0005b2015-03-11 16:32:45 -0400343If `status.submoduleSummary` is set to a non zero number or true (identical
Jeff King46b77a62009-09-05 04:52:18 -0400344to -1 or an unlimited number), the submodule summary will be enabled for
345the long format and a summary of commits for modified submodules will be
Jens Lehmannbb58b692013-09-11 21:07:15 +0200346shown (see --summary-limit option of linkgit:git-submodule[1]). Please note
347that the summary output from the status command will be suppressed for all
348submodules when `diff.ignoreSubmodules` is set to 'all' or only for those
349submodules where `submodule.<name>.ignore=all`. To also view the summary for
350ignored submodules you can either use the --ignore-submodules=dirty command
351line option or the 'git submodule summary' command, which shows a similar
352output but does not honor these settings.
Ping Yinac8d5af2008-04-12 23:05:32 +0800353
Junio C Hamano56ae8df2008-05-28 16:55:27 -0700354SEE ALSO
Josh Triplettcedb8d52007-06-02 10:08:54 -0700355--------
Dan McGee5162e692007-12-29 00:20:38 -0600356linkgit:gitignore[5]
Junio C Hamano31fcd632007-01-17 01:11:01 -0800357
Junio C Hamano3f971fc2005-08-14 17:24:36 -0700358GIT
359---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200360Part of the linkgit:git[1] suite