I used git reflog
to identify a hash for when I created a particular branch. I got the hash of fe1ddcdef
. I haven't pushed this branch to the remote yet. I'm now trying to find the date and time for when fe1ddcdef
took place. git reflog
only shows me:
fe1ddcdef HEAD@{11}: checkout: moving from master to handoff
which does not have a date or time.
git log
is far too verbose, since it contains commits from all of my colleagues and I can't easily find the needle of fe1ddcdef
in that haystack.
How can I simply find the date and time of commit fe1ddcdef
?
Hover over the 'xx days ago' label next to the relevant commit under the History tab, pause and wait for the Tooltip to appear.
If you want to see commit date, you can use one of the many command line options, such as --pretty=fuller . Note the (slight) difference between the author date and commit date above.
There are actually two different timestamps recorded by Git for each commit: the author date and the commit date. When the commit is created both the timestamps are set to the current time of the machine where the commit was made.
If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With