How to show date and time of a commit by hash

Simply use :

git show fe1ddcdef

… to display the content of the commit. Actually, once you have any expression that identifies a commit object, you can use it in all places that require a revision. These expressions can be an hexadecimal hash (even partial), a branch name or a tag name. It can also be one of these, associated to one or many operators such as “^”, or “~”, or “@”.

This means that you can also use git log fe1ddcdef to get the full history of the branch starting from this point.

If you want to get only date and time of it and nothing else, you can type :

git show --no-patch --no-notes --pretty='%cd' fe1ddcdef

Replace '%cd' by '%h %cd %s' to add hash summary and commit’s subject message.

Leave a Comment