繁体   English   中英

git log和git show的不同漂亮格式?

[英]Different pretty formats for git log and git show?

我在.gitconfig有这个:

[format]
    pretty = %C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)

这使得git log的输出看起来像这样(加上一些漂亮的颜色):

6b1d043 (origin/master) - Ismail Badawi : Don't redirect to index after saving query. (28 hours ago)
df98a3e - Ismail Badawi : Store example queries in database & cache results (30 hours ago)
6de44ab - Ismail Badawi : Add sanity check tests for different pages. (31 hours ago)
7b6b46b - Ismail Badawi : Save query results for saved queries. (31 hours ago)

我发现这种格式很容易扫描。 我不喜欢它也会影响git show ; 特别是,我希望能够在git show的输出中看到完整的提交消息,而不仅仅是标题行; 还有实际的日期而不是相对的,作者的电子邮件等。

有没有办法为git loggit show使用不同的默认格式?

git logshow使用相同的配置。

--format=<format>
    Pretty-print the contents
    ...
    Note: you can specify the default pretty format in the repository configuration (see git-config(1)).

https://www.kernel.org/pub/software/scm/git/docs/git-show.html

但是,为什么不直接为其中一个定义别名并使用它? 例如,您可以使用git alias.vshow 'show --pretty=<your other format string>'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM