Search code examples
gitgit-log

Git pretty format short format date doesn't work


I have an alias for listing commits in customized pretty format, that contains the author date in short format, i.e. YYYY-MM-DD, for which I use the %as placeholder. It used to work fine until a couple of days.

Long story short, git log --pretty=format:%as should print the author date in short format, but it only prints %as for each commit line.

I tried other date format like git log --pretty=format:%aD and git log --pretty=format:%ad, and they seem to work fine.

I am experiencing this in Git Bash on Windows 10, having git version 2.24.1.windows.2

As a reference, I have used this documentation for the pretty format.

Anybody knows what could be the issue, or is there any workaround?


Solution

  • I have resolved the issue, thanks to the insightful comment from @Biffen. Apparently, the %as placeholder was not available in the version I was using 2.24.1. Updating to 2.29.2 fixed the thing.

    The only logical explanation would be that I had the aliases transferred from another laptop, and probably the 'new' laptop had already installed older git version.

    Thanks @Biffen.