Vinoth
Vinoth

Reputation: 187

How to change the git log committed log date format

Is there any possible way to change the git log data format from "2019-08-22 06:38:34 +0000" to "20190822063834" in git log command itself or if any alternative options are great

git log  --pretty=format:"%ci" --decorate=full

2019-08-22 06:38:34 +0000
2019-08-22 06:38:34 +0000  
2019-08-22 06:38:33 +0000
2019-08-22 06:38:33 +0000
2019-08-22 06:38:32 +0000
2019-08-22 06:38:26 +0000

git log  --pretty=format:"%ci" --decorate=full

20190822063834
20190822063834
20190822063833
20190822063833
20190822063832
20190822063826

Upvotes: 2

Views: 82

Answers (1)

VonC
VonC

Reputation: 1323115

You can try using a custom date format, as shown here:

git log --date=format:'%Y%m%d%H%M%S' --pretty=format:"%cd" --decorate=full

Note that I use %cd which respects --date= option, not %ci (ISO 8601-like format).

Upvotes: 1

Related Questions