This is possible with git 2.7 (Q4 2015), which introduces -local as an instruction.
This means that in addition to:
--date=(relative|local|default|iso|iso-strict|rfc|short|raw)
you will also have:
--date=(relative-local|default-local|iso-local|iso-strict-local|rfc-local|short-local|raw-local)
Now you can request the date format using your local time zone .
In your case:
git log --date=iso-local -3 --pretty=tformat:'%cd %h' --abbrev-commit ^^^^^^^^^ |____| that part is new!
See commit 99264e9 , commit db7bae2 , commit dc6d782 , commit f3c1ba5 , commit f95cecf , commit 4b1c5e1 , commit 8f50d26 , commit 78a8441 , commit 2df4e29 (September 03, 2015) John Keeping ( johnkeeping ) .
See commit add00ba , commit 547ed71 (September 03, 2015) by Jeff King ( peff ) .
(the merger of Junio S Hamano - gitster - to commit 7b09c45 , 05 October 2015)
In particular, commit add00ba mentions:
date : make " local " orthogonal to the date:
Most of the “ --date ” modes relate to the date format: which elements we show and in what order.
But " --date=local " is a bit strange. This means "show the date in the usual format, but using the local time zone."
The time zone we use is orthogonal to the actual format, and there is no reason why we couldn’t "localize iso8601", etc.
This patch adds the boolean field " local " to " struct date_mode " and discards the DATE_LOCAL element from the date_mode_type enumeration (now it is just DATE_NORMAL plus local=1 ).
A new feature is available to users by adding " -local " to any date mode (for example, " iso-local "), and we save " local " as an alias for " default-local " for backward compatibility.
VonC Oct 07 '15 at 11:08 2015-10-07 11:08
source share