简体   繁体   中英

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 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.

Result on Windows PC:

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

Result on CentOS server same repository:

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

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 . Consider updating it. I might be wrong but I think it showed up in git in version v2.2.0 . https://github.com/git/git/commit/466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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