gitgit-loggit-show

How to print commit dates in %Y%m%d format in git log?


I am trying to print the commit date in 2021April09 format using --date=format:'%Y%b%d' but it gives me segmentation fault. Neither of below works for me even for standard formats.

git log --pretty=format:%cd --date=format:%Y%m%d -5

git log --pretty=format:%cd --date=format:'%Y-%m-%d' -5

I know I can use git log --pretty=format:%cd --date=short to get the shorter version but I want to use strftime format to print the abbreviated month etc


Solution

  • git log --pretty=format:%cd --date=format:%Y%m%d -5

    git log --pretty=format:%cd --date=format:'%Y-%m-%d' -5

    Both of the above works fine from a CMake based command invocation but won't work for me from Git BASH on windows (MINGW32). I also tried updating Git the latest 2.31.x.

    I keep getting segmentation fault. I have moved on to something else but will be looking at this thread to see if anyone else has any suggestion. Thanks