Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-status(1) |
| 2 | ============= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 6 | git-status - Show the working tree status |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 12 | 'git status' [<options>...] [--] [<pathspec>...] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 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 |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 19 | tracked by Git (and are not ignored by linkgit:gitignore[5]). The first |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 20 | are what you _would_ commit by running `git commit`; the second and |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 21 | third are what you _could_ commit by running 'git add' before running |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 22 | `git commit`. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 23 | |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 24 | OPTIONS |
| 25 | ------- |
Junio C Hamano | 8fd5230 | 2006-08-10 00:18:08 | [diff] [blame] | 26 | |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 27 | -s:: |
| 28 | --short:: |
| 29 | Give the output in the short-format. |
| 30 | |
Junio C Hamano | f5de4cf | 2010-06-19 00:33:17 | [diff] [blame] | 31 | -b:: |
| 32 | --branch:: |
| 33 | Show the branch and tracking info even in short-format. |
| 34 | |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 35 | --porcelain:: |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 36 | Give the output in an easy-to-parse format for scripts. |
| 37 | This is similar to the short output, but will remain stable |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 38 | across Git versions and regardless of user configuration. See |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 39 | below for details. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 40 | |
Junio C Hamano | a129545 | 2012-11-13 22:32:04 | [diff] [blame] | 41 | --long:: |
| 42 | Give the output in the long-format. This is the default. |
| 43 | |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 44 | -u[<mode>]:: |
| 45 | --untracked-files[=<mode>]:: |
Junio C Hamano | 36a4dbc | 2011-02-22 07:51:32 | [diff] [blame] | 46 | Show untracked files. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 47 | + |
Junio C Hamano | 36a4dbc | 2011-02-22 07:51:32 | [diff] [blame] | 48 | The mode parameter is optional (defaults to 'all'), and is used to |
Junio C Hamano | 5e7f131 | 2013-03-21 22:49:01 | [diff] [blame] | 49 | specify the handling of untracked files. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 50 | + |
Junio C Hamano | 36a4dbc | 2011-02-22 07:51:32 | [diff] [blame] | 51 | The possible options are: |
| 52 | + |
Junio C Hamano | 5e7f131 | 2013-03-21 22:49:01 | [diff] [blame] | 53 | - 'no' - Show no untracked files. |
| 54 | - 'normal' - Shows untracked files and directories. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 55 | - 'all' - Also shows individual files in untracked directories. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 56 | + |
Junio C Hamano | 5e7f131 | 2013-03-21 22:49:01 | [diff] [blame] | 57 | When `-u` option is not used, untracked files and directories are |
| 58 | shown (i.e. the same as specifying `normal`), to help you avoid |
| 59 | forgetting to add newly created files. Because it takes extra work |
| 60 | to find untracked files in the filesystem, this mode may take some |
| 61 | time in a large working tree. You can use `no` to have `git status` |
| 62 | return more quickly without showing untracked files. |
| 63 | + |
Junio C Hamano | 36a4dbc | 2011-02-22 07:51:32 | [diff] [blame] | 64 | The default can be changed using the status.showUntrackedFiles |
| 65 | configuration variable documented in linkgit:git-config[1]. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 66 | |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 67 | --ignore-submodules[=<when>]:: |
| 68 | Ignore changes to submodules when looking for changes. <when> can be |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 69 | either "none", "untracked", "dirty" or "all", which is the default. |
| 70 | Using "none" will consider the submodule modified when it either contains |
| 71 | untracked or modified files or its HEAD differs from the commit recorded |
| 72 | in the superproject and can be used to override any settings of the |
| 73 | 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When |
Junio C Hamano | 7d44952 | 2010-07-01 00:08:51 | [diff] [blame] | 74 | "untracked" is used submodules are not considered dirty when they only |
| 75 | contain untracked content (but they are still scanned for modified |
| 76 | content). Using "dirty" ignores all changes to the work tree of submodules, |
| 77 | only changes to the commits stored in the superproject are shown (this was |
| 78 | the behavior before 1.7.0). Using "all" hides all changes to submodules |
| 79 | (and suppresses the output of submodule summaries when the config option |
| 80 | `status.submodulesummary` is set). |
| 81 | |
Junio C Hamano | 4c4b012 | 2011-06-30 01:19:32 | [diff] [blame] | 82 | --ignored:: |
| 83 | Show ignored files as well. |
| 84 | |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 85 | -z:: |
| 86 | Terminate entries with NUL, instead of LF. This implies |
| 87 | the `--porcelain` output format if no other format is given. |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 88 | |
Junio C Hamano | 22700fb | 2012-05-03 23:07:25 | [diff] [blame] | 89 | --column[=<options>]:: |
| 90 | --no-column:: |
| 91 | Display untracked files in columns. See configuration variable |
| 92 | column.status for option syntax.`--column` and `--no-column` |
| 93 | without options are equivalent to 'always' and 'never' |
| 94 | respectively. |
| 95 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 96 | |
| 97 | OUTPUT |
| 98 | ------ |
| 99 | The output from this command is designed to be used as a commit |
Junio C Hamano | 52b6ba3 | 2014-04-01 00:26:48 | [diff] [blame] | 100 | template comment. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 101 | The default, long format, is designed to be human readable, |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 102 | verbose and descriptive. Its contents and format are subject to change |
| 103 | at any time. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 104 | |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 105 | The paths mentioned in the output, unlike many other Git commands, are |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 106 | made relative to the current directory if you are working in a |
| 107 | subdirectory (this is on purpose, to help cutting and pasting). See |
| 108 | the status.relativePaths config option below. |
Junio C Hamano | 00b8b63 | 2007-12-07 09:50:49 | [diff] [blame] | 109 | |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 110 | Short Format |
| 111 | ~~~~~~~~~~~~ |
| 112 | |
| 113 | In the short-format, the status of each path is shown as |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 114 | |
| 115 | XY PATH1 -> PATH2 |
| 116 | |
Junio C Hamano | b76a686 | 2012-05-02 22:02:46 | [diff] [blame] | 117 | where `PATH1` is the path in the `HEAD`, and the " `-> PATH2`" part is |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 118 | shown only when `PATH1` corresponds to a different path in the |
Junio C Hamano | fc5d735 | 2010-04-24 02:59:11 | [diff] [blame] | 119 | index/worktree (i.e. the file is renamed). The 'XY' is a two-letter |
| 120 | status code. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 121 | |
Junio C Hamano | b76a686 | 2012-05-02 22:02:46 | [diff] [blame] | 122 | The fields (including the `->`) are separated from each other by a |
Junio C Hamano | fc5d735 | 2010-04-24 02:59:11 | [diff] [blame] | 123 | single space. If a filename contains whitespace or other nonprintable |
| 124 | characters, that field will be quoted in the manner of a C string |
| 125 | literal: surrounded by ASCII double quote (34) characters, and with |
| 126 | interior special characters backslash-escaped. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 127 | |
Junio C Hamano | fc5d735 | 2010-04-24 02:59:11 | [diff] [blame] | 128 | For paths with merge conflicts, `X` and 'Y' show the modification |
| 129 | states of each side of the merge. For paths that do not have merge |
| 130 | conflicts, `X` shows the status of the index, and `Y` shows the status |
| 131 | of the work tree. For untracked paths, `XY` are `??`. Other status |
| 132 | codes can be interpreted as follows: |
| 133 | |
| 134 | * ' ' = unmodified |
| 135 | * 'M' = modified |
| 136 | * 'A' = added |
| 137 | * 'D' = deleted |
| 138 | * 'R' = renamed |
| 139 | * 'C' = copied |
| 140 | * 'U' = updated but unmerged |
| 141 | |
Junio C Hamano | 4c4b012 | 2011-06-30 01:19:32 | [diff] [blame] | 142 | Ignored files are not listed, unless `--ignored` option is in effect, |
| 143 | in which case `XY` are `!!`. |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 144 | |
| 145 | X Y Meaning |
| 146 | ------------------------------------------------- |
| 147 | [MD] not updated |
| 148 | M [ MD] updated in index |
| 149 | A [ MD] added to index |
Junio C Hamano | fc5d735 | 2010-04-24 02:59:11 | [diff] [blame] | 150 | D [ M] deleted from index |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 151 | R [ MD] renamed in index |
| 152 | C [ MD] copied in index |
| 153 | [MARC] index and work tree matches |
| 154 | [ MARC] M work tree changed since index |
| 155 | [ MARC] D deleted in work tree |
| 156 | ------------------------------------------------- |
| 157 | D D unmerged, both deleted |
| 158 | A U unmerged, added by us |
| 159 | U D unmerged, deleted by them |
| 160 | U A unmerged, added by them |
| 161 | D U unmerged, deleted by us |
| 162 | A A unmerged, both added |
| 163 | U U unmerged, both modified |
| 164 | ------------------------------------------------- |
| 165 | ? ? untracked |
Junio C Hamano | 4c4b012 | 2011-06-30 01:19:32 | [diff] [blame] | 166 | ! ! ignored |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 167 | ------------------------------------------------- |
| 168 | |
Junio C Hamano | f5de4cf | 2010-06-19 00:33:17 | [diff] [blame] | 169 | If -b is used the short-format status is preceded by a line |
| 170 | |
| 171 | ## branchname tracking info |
| 172 | |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 173 | Porcelain Format |
| 174 | ~~~~~~~~~~~~~~~~ |
| 175 | |
| 176 | The porcelain format is similar to the short format, but is guaranteed |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 177 | not to change in a backwards-incompatible way between Git versions or |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 178 | based on user configuration. This makes it ideal for parsing by scripts. |
| 179 | The description of the short format above also describes the porcelain |
| 180 | format, with a few exceptions: |
| 181 | |
| 182 | 1. The user's color.status configuration is not respected; color will |
| 183 | always be off. |
| 184 | |
| 185 | 2. The user's status.relativePaths configuration is not respected; paths |
| 186 | shown will always be relative to the repository root. |
| 187 | |
| 188 | There is also an alternate -z format recommended for machine parsing. In |
Junio C Hamano | fc5d735 | 2010-04-24 02:59:11 | [diff] [blame] | 189 | that format, the status field is the same, but some other things |
Junio C Hamano | ef5a2f9 | 2011-05-31 19:53:33 | [diff] [blame] | 190 | change. First, the '\->' is omitted from rename entries and the field |
| 191 | order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL |
Junio C Hamano | fc5d735 | 2010-04-24 02:59:11 | [diff] [blame] | 192 | (ASCII 0) follows each filename, replacing space as a field separator |
| 193 | and the terminating newline (but a space still separates the status |
| 194 | field from the first filename). Third, filenames containing special |
| 195 | characters are not specially formatted; no quoting or |
Junio C Hamano | bcdb12e | 2012-05-10 18:45:15 | [diff] [blame] | 196 | backslash-escaping is performed. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 197 | |
Junio C Hamano | f9771f6 | 2007-01-17 17:42:30 | [diff] [blame] | 198 | CONFIGURATION |
| 199 | ------------- |
| 200 | |
| 201 | The command honors `color.status` (or `status.color` -- they |
| 202 | mean the same thing and the latter is kept for backward |
| 203 | compatibility) and `color.status.<slot>` configuration variables |
| 204 | to colorize its output. |
| 205 | |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 206 | If the config variable `status.relativePaths` is set to false, then all |
| 207 | paths shown are relative to the repository root, not to the current |
| 208 | directory. |
| 209 | |
Junio C Hamano | e3ddb5b | 2008-04-21 00:48:07 | [diff] [blame] | 210 | If `status.submodulesummary` is set to a non zero number or true (identical |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 211 | to -1 or an unlimited number), the submodule summary will be enabled for |
| 212 | the long format and a summary of commits for modified submodules will be |
Junio C Hamano | 369e340 | 2013-10-15 18:40:25 | [diff] [blame] | 213 | shown (see --summary-limit option of linkgit:git-submodule[1]). Please note |
| 214 | that the summary output from the status command will be suppressed for all |
| 215 | submodules when `diff.ignoreSubmodules` is set to 'all' or only for those |
| 216 | submodules where `submodule.<name>.ignore=all`. To also view the summary for |
| 217 | ignored submodules you can either use the --ignore-submodules=dirty command |
| 218 | line option or the 'git submodule summary' command, which shows a similar |
| 219 | output but does not honor these settings. |
Junio C Hamano | e3ddb5b | 2008-04-21 00:48:07 | [diff] [blame] | 220 | |
Junio C Hamano | 9049d91 | 2008-05-29 02:09:50 | [diff] [blame] | 221 | SEE ALSO |
Junio C Hamano | 679d22d | 2007-06-02 21:13:44 | [diff] [blame] | 222 | -------- |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 223 | linkgit:gitignore[5] |
Junio C Hamano | f9771f6 | 2007-01-17 17:42:30 | [diff] [blame] | 224 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 225 | GIT |
| 226 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 227 | Part of the linkgit:git[1] suite |