我正在运行一个脚本来获取服务器中一些存储库的提交数据。我使用的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
发布于 2021-07-13 16:54:03
这很可能是因为您在centos上使用的git版本不支持--pretty=%cI
。考虑更新它。我可能错了,但我认为它已经在v2.2.0
版本的git中显示出来了。https://github.com/git/git/commit/466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf
https://stackoverflow.com/questions/68365437
复制