git - 将 git 日志日期格式保存在 .gitconfig 中

标签 git

我可以为 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/

相关文章:

git - 如何在 Windows 上使用 git-extras(PortableGit)

git-tf: checkin 从要删除的文件夹中移动文件的提交

git - 如何为子模块设置 git core.autocrlf

c - 使用 libgit2 进行 Git checkout

git - 鲍尔 ECMDERR 致命 : dumb http transport does not support --depth

git - 无法在 Ubuntu 上为 Git 安装核心库

带通配符的 Git rm 找不到现有文件

git - 将过滤器条目添加到 git 配置文件

linux - 如何在系统启动时 pull git 存储库的最新版本

git - 如何在 git 中获取分配给文件的所有标签?