42

I'd like git status to always use the short format:

$ git status --short
 M file1
 M dir/file2
?? file_untracked3
?? dir/file_untracked4

There doesn't seem to exist a configuration option for this, and git config --global alias.status "status --short" does not work. I haven't managed to create an alias in zsh either.

How can I make git status to use the short format by default?

user905686
  • 4,491
  • 8
  • 39
  • 60
Adam Lindberg
  • 16,447
  • 6
  • 65
  • 85
  • Include your ~/.gitconfig here. – Bartosz May 28 '10 at 08:55
  • Is using something like `stat` instead of `status` as an alias an option? – Lucas May 28 '10 at 09:07
  • @Bartosz: It does not contain anything interesting regarding this problem. – Adam Lindberg May 28 '10 at 10:04
  • Starting git 1.8.4, a tentative new feature was proposed, as a config `status.short`, which would allow you to define "`status --short`" by default, but the implementation isn't ready yet. See [my answer below](http://stackoverflow.com/a/17282874/6309) – VonC Jun 25 '13 at 05:49
  • ... And that `status.short` config new feature is back, still for git1.8.4 (July/August 2013). See [my edited answer below](http://stackoverflow.com/a/17282874/6309) – VonC Jul 12 '13 at 06:04

3 Answers3

40

Starting git1.8.4 (July 2013), you can configure git status to use short by default.
See commit 50e4f757f4adda096239c1ad60499cf606bf2c6f:

Some people always run 'git status -s'.
The configuration variable status.short allows to set it by default.

So:

git config status.short true

And you would be all set!


Ben Allred adds in the comments:

A quick test shows that git config status.branch true works as well, to show the branch information in conjunction with short-format.


It was reversed for a time:

Commit 908a0e6b98e5a7c4b299b3643823bdefb4fa512e:

It makes it impossible to "git commit" when status.short is set, and also "git status --porcelain" output is affected by status.branch.

But it is now back, still for git 1.8.4 (July/August 2013)

See commit f0915cbaf476d63f72c284057680809ed24fbe0d:

commit: make it work with status.short

With "status.short" set, it is now impossible to commit with status.short set, because it acts like "git commit --short", and it is impossible to differentiate between a status_format set by the command-line option parser versus that set by the config parser.

To alleviate this problem, clear status_format as soon as the config parser has finished its work.

Signed-off-by: Ramkumar Ramachandra

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @AdamLindberg you can still use your alias though. It would be an alias for '`git status`' only ;) The point is: you now can define `git status --short` by default for all repos (global config), keep the alias `git s`, and add another alias `git st` for `git status --long`. – VonC Jun 25 '13 at 05:22
  • @AdamLindberg I spoke too soon: this feature is not yet ready (as my updated answer details). – VonC Jun 25 '13 at 05:48
  • @AdamLindberg the feature is now back for the upcoming git1.8.4 – VonC Jul 12 '13 at 11:55
  • A quick test shows that `git config status.branch true` works, as well, to show the branch information in conjunction with short-format. – Ben Allred Sep 12 '14 at 17:30
  • @BenAllred interesting. I have included your comment in the answer for more visibility. – VonC Sep 12 '14 at 17:39
36

Use a different alias. Instead of trying to alias 'status', do:

git config --global alias.s 'status --short'

Now "git s" gives you short output, and "git status" gives you long output.

William Pursell
  • 204,365
  • 48
  • 270
  • 300
0

You may create an alias.

But I'd create bash script:

#!/bin/bash
git status --short

save this script in ~/bin/gits (or /usr/bin/gits and chmod 555), so typing gits gives what you want.

takeshin
  • 49,108
  • 32
  • 120
  • 164