簡體   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