【发布时间】:2011-09-15 11:33:03
【问题描述】:
我需要有如下格式:
git log --decorate --graph --oneline --date-order
但我也需要它:
- 包含日期(短)
- 拥有相同的颜色
我试过了:
git log --decorate --graph --oneline --date-order \
--date=short --pretty=format:"%h %ad %s"
但它更难阅读(没有颜色)并且不包括分支/标签
最接近的简单解决方案是(感谢VonC):
git log --graph --pretty=format:'%C(yellow)%h%Creset \
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \
--abbrev-commit --date=short
【问题讨论】:
-
您可以使用 VonC 的示例,但对于 refspec 使用 %C(auto)%d 来自动着色参考
-
将答案附加到一个人的问题中是令人困惑的。通过接受正确的答案更好地正确使用堆栈溢出。