The show command may be what you want. Try
git show -s --format=%ci <commit>
Other formats for the date string are available as well. Check the manual page for details.
If you want to see only the date of a tag you'd do:
git show -s --format=%ci <mytagname>^{commit}
which gives: 2013-11-06 13:22:37 +0100
Or do:
git show -s --format=%ct <mytagname>^{commit}
which gives UNIX timestamp: 1383740557
If you like to have the timestamp without the timezone but local timezone do
git log -1 --format=%cd --date=local
Which gives this depending on your location
Mon Sep 28 12:07:37 2015
You can use the git show
command.
To get the last commit date from git repository in a long(Unix epoch timestamp):
git show -s --format=%ct
1605103148
Note: You can visit the git-show documentation to get a more detailed description of the options.
In case that you want to format the date (or hour) by yourself:
git show -s --date=format:'%Y%m%d-%H%M' --format=%cd <commit id | default is the last commit>
# example output:
20210712-1948
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