我怎样才能让'git status'始终使用短格式? [英] How can I get 'git status' to always use short format?

查看:141
本文介绍了我怎样才能让'git status'始终使用短格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 git status 始终使用短格式:

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

似乎没有配置选项, git config --global alias.statusstatus --short不起作用。我还没有设法在 zsh 中创建别名。



如何使 git status 默认使用短格式?

解决方案

开始 git1.8.4(2013年7月),您可以配置 git status 默认使用short。

请参阅承诺50e4f757f4adda096239c1ad60499cf606bf2c6f



有些人总是运行' git status -s '。

配置变量 status.short 允许默认设置它。


所以:

  git config status.short true 

你会一切安排!






Ben Allred 添加在评论中:


快速测试显示 git配置状态.branch true 也适用于显示分支信息和短格式。







一段时间后,它被颠倒过来:

提交908a0e6b98e5a7c4b299b3643823bdefb4fa512e


status.short git commit c>被设置,并且 git status --porcelain 输出受到 status.branch 的影响。 p>

但现在又回来了,仍然是git 1.8.4(2013年7月/ 8月)

请参阅提交f0915cbaf476d63f72c284057680809ed24fbe0d


提交:使用 status.short

使用 status.short 设置,现在不可能使用status.short set进行提交,因为e的行为就像 git commit --short ,并且不可能区分由命令行选项解析器设置的status_format与配置解析器设置的status_format。



为了缓解这个问题,一旦配置解析器完成工作,请清除 status_format



签名:Ramkumar Ramachandra



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?

解决方案

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

这篇关于我怎样才能让'git status'始终使用短格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆