Git Reference ยท Configuration Options
status.* settings
Reference for status.* settings: status.short, status.branch, status.showUntrackedFiles, status.aheadBehind, status.renames and status.showStash, with examples.
The status.* variables set the defaults for git status. The command is one you run dozens of times a day, so small defaults matter: the short two-column format instead of the long prose, the branch line, how untracked directories are listed, and whether Git spends time counting commits ahead of and behind upstream.
Every setting here has a matching command-line option, and the option wins over the configuration. IDE integrations and prompts that call git status --porcelain are not affected by most of these, because porcelain output is fixed on purpose.
git config --global status.short true git config --global status.branch true git config --global status.showUntrackedFiles all git config --global status.showStash true
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
git config status.<name> <value>
| Setting | Values | Description |
|---|---|---|
status.short |
true, false |
Use the short format (git status -s) by default. |
status.branch |
true, false |
Show the branch and tracking line (git status -b), also in short format. |
status.showUntrackedFiles |
no, normal, all |
normal lists untracked directories as one entry, all lists every file inside, no hides untracked files. Default normal. |
status.aheadBehind |
true, false |
Compute "ahead N, behind M" for the branch. When false, Git only says that the branches differ, which is faster in huge repositories. Default true. |
status.renames |
true, false, copies |
Detect renames (or copies) between HEAD and the index and between the index and the working tree. Falls back to diff.renames. |
status.relativePaths |
true, false |
Show paths relative to the current directory. Default true. |
status.submoduleSummary |
true, false, number |
Include a summary of submodule commits. A number limits the entries; -1 means unlimited. |
status.showStash |
true, false |
Print the number of stash entries (git status --show-stash). |
status.displayCommentPrefix |
true, false |
Prefix long-format lines with the comment character, as in a commit message template. Default false. |
Edge cases: the command-line options --short, --long, --branch, --untracked-files=<mode>, --ahead-behind, --no-ahead-behind, --renames and --no-renames override these settings. --porcelain ignores status.short and status.branch so scripts keep working.
Usage notes
- Short format column meanings: the first column is the index versus HEAD, the second is the working tree versus the index.
??is untracked,!!is ignored (shown only with--ignored), andUUis an unresolved conflict. In-bmode the first line is## main...origin/main [ahead 1]. showUntrackedFiles=nois a trade-off. On a repository with a million files, scanning for untracked files is the slowest part ofgit status. Turning it off makes status fast, but you will no longer notice files you forgot to add. Seecore.fsmonitorand the untracked cache for a gentler approach.aheadBehind=falsehelps on very large histories, where counting commits between two remote-heavy branches takes noticeable time. Without the counts you still see whether the branches have diverged.- Scripts should not depend on user configuration. Use
git status --porcelain=v2and pass the options you need explicitly; that output is stable across versions and user settings. - Pair
status.shortwithstatus.branch: the short format on its own hides which branch you are on, and that is easy to forget. - Remote-tracking information in the long format (
Your branch is ahead of 'origin/main' by 1 commit) comes from the branch's configured upstream; seebranch.*. - Ignore rules are read through
.gitignoreandcore.excludesFile;status.*only changes how results are displayed.
Related
git status,branch.*,core.fsmonitor,diff.*- Lessons: Status and diff, Staging