You could either use a hook, probably the post-receive hook to store the required information somewhere yourself, or simply enable the reflog (it is disabled by default in a bare repository). The reflog automatically keeps track of the local history of a branch, and eg. git reflog -1 --format=%H master@{12:00}
will tell you what commit was the master ref pointing to at 12:00.
Note that the reflog expires, you can configure the expiration time with gc.reflogexpire.