Normally I use two PCs, say: PC1 and PC2.
On both of them I'm using CygWin on Windows 10.
They had the same configuration.
On PC1 I was trying to do some adjustments on how to display the date and time when doing:
$ git log
I was trying multiple bash and git commands.
In the past and also currently on PC2 when I do:
$ date
I get the following:
Tue Sep 25 16:17:34 CDT 2018
but on PC1 (the wrong one), with the same command, I get:
Tue, Sep 25, 2018 16:17:34
where you can see that the TimeZone indicator is not showing up.
Also, now on PC1, when I do a commit and then list the history with: $ git log, dates are like:
Date: Tue Sep 25 22:58:42 2018 +0100
where it should be:
Date: Tue Sep 25 16:58:42 2018 -0500
because my current timezone is: CDT (America/Chicago) (-05:00)
Any idea on how to solve this?
Thanks!
[EDIT 1]
Responding to suggestion from @Johan below where he said:
--- begin of comment ---
You need to set the git log --date to local.
git config --global log.date local
--- end of comment ---
I just tried that and now the date that shows up on my last commit doesn't have the TimeZone indicator. Using the same time reference as before it would be:
Date: Tue Sep 25 22:58:42 2018
I need to get the TimeZone indicator on the commit list.
[EDIT 2]
Responding to suggestion from @Johan below where he said:
--- begin of comment ---
You need to set the git log --date to default.
git config --global log.date default
--- end of comment ---
I just tried that and now and I get again:
Date: Tue Sep 25 22:58:42 2018 +0100
even trying new commits.
I don’t think this will address the root issue on your system, but it will certainly help with git’s commit dates. Git uses an environment variable called TZ to set the timezone (for any command, not only commit), so you can set an alias for it in your shell:
alias git='TZ=CDT /usr/bin/git'
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