Can you order git log by commit timestamp?

I was pretty sure it was possible using only git commands but I cannot find it now. --author-date-order does not work for me on rebased branch, as suggested in another answer.

So one way to do that would be to use git log pretty=format: ... to print the commit date in ISO format and let sort or sort -r fix the order.

For example:

git log --pretty=format:"%ad %h by %an, %s" --date=iso | sort -r | less

This will print the ISO date, the hash, the author and the message of the commit and sort it with the latest commits first.

You will find more format options at the PRETTY FORMATS section of git log --help if you need more information per commit.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)