git 使用 %cI 占位符 returns "cI" 而不是提交日期的日志格式

git log pretty format with %cI placeholder returns "cI" instead of the commit date

我是 运行 一个脚本,用于获取服务器中某些存储库的提交数据。 我使用的 git 命令是这样的:

git log HEAD -1 --pretty=%H~%h~%cI~%cE~%cn~%s

它在我的 windows 电脑上完美运行,但在我的 CentOS 服务器上,它打印字符串“cI”而不是格式化的 ISO 日期。

Windows PC 上的结果:

40c688e4976d28a560f5711e73c2a933da3cfbbe~40c688e~2021-07-02T17:18:48-04:00~usertest@mail.com~gituser1~Commit into master

CentOS 服务器相同存储库上的结果:

40c688e4976d28a560f5711e73c2a933da3cfbbe~40c688e~cI~usertest@mail.com~gituser1~Commit into master

可能是什么问题?

编辑: 我在 windows 上使用 git 版本 2.30.0.windows.2,在 CentOS

上使用 git 版本 1.8.3.1

这很可能是因为您在 centos 上使用的 git 版本不支持 --pretty=%cI。考虑更新它。我可能是错的,但我认为它出现在版本 v2.2.0 的 git 中。 https://github.com/git/git/commit/466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf