简体   繁体   English

带有 %cI 占位符的 git log 漂亮格式返回“cI”而不是提交日期

[英]git log pretty format with %cI placeholder returns “cI” instead of the commit date

I'm running a script to get commit data of some repositories in a server.我正在运行一个脚本来获取服务器中某些存储库的提交数据。 The git command I am using is this:我使用的 git 命令是这样的:

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

It works perfectly on my windows pc, but in my server with CentOS, it prints the string "cI" instead of the formated ISO date.它在我的 windows pc 上运行良好,但在我的 CentOS 服务器中,它打印字符串“cI”而不是格式化的 ISO 日期。

Result on Windows PC:在 Windows PC 上的结果:

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

Result on CentOS server same repository:在 CentOS 服务器相同存储库上的结果:

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

What could be the problem?可能是什么问题呢?

EDIT: Im using git version 2.30.0.windows.2 on windows and git version 1.8.3.1 on CentOS编辑:我在 Windows 上使用 git 版本 2.30.0.windows.2,在 CentOS 上使用 git 版本 1.8.3.1

It's more than likely due to the fact that you are using a version of git on centos that didn't support --pretty=%cI .这很可能是因为您在 centos 上使用的 git 版本不支持--pretty=%cI Consider updating it.考虑更新它。 I might be wrong but I think it showed up in git in version v2.2.0 .我可能是错的,但我认为它出现在版本v2.2.0 git 中。 https://github.com/git/git/commit/466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf https://github.com/git/git/commit/466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf

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

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