我可以为 git log
指定自定义日期格式
git log --reverse --date=format:'%Y-%b-%d %H:%M:%S'
但是当我尝试将其保存在 .gitconfig
中时,它没有任何效果
[format]
date = format:'%Y-%b-%d %H:%M:%S'
如何在 .gitconfig
中自定义日期格式?
另外,如何将 --reverse
保存在 .gitconfig
中?
最佳答案
尝试指定 date=format
对于 log
命令而不是format
如下
[log]
date = format:'%Y-%b-%d %H:%M:%S'
用于指定--reverse
您可以使用alias
如下所示:
[log]
date=format:'%Y-%b-%d %H:%M:%S'
[alias]
lg = log --reverse
进行这些更改后,您的 git log
将以指定的格式打印,当您写入 git lg
时将打印git log
与 --reverse
.
关于git - 将 git 日志日期格式保存在 .gitconfig 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54838955/