繁体   English   中英

带有 %cI 占位符的 git log 漂亮格式返回“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 pc 上运行良好,但在我的 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM