Config timezone to prevent chaos when DST/changing timezone
- From
- Devste Devste <devstemail@gmail.com>
- Date
- Feb 7, 2025, 22:02 UTC
- Message-ID
- <CANM0SV3DXQeNinmy1Spj7n6G=5s3jMcFrAb0Ayun6ago7F3qWw@mail.gmail.com>
Issue: With DST or manual timezone changes (e.g. travelling) you can end up with commits that are illogically sorted - newer commits have an author/committer date that is older than older commits.
I found the discussion about user.hideTimezone https://public-inbox.org/git/CAEOYnAQYMrNAe9s1V-0DVLdL-B_KpHMDP5e=yRnbCkMWdrvFHQ@mail.gmail.com/T/#u and https://git.github.io/rev_news/2023/08/31/edition-102/
While there are workarounds, these aren't possible in all cases (e.g. "export TZ=UTC0" won't work with many IDEs since they run git in a separate shell and has side-effects on non-git commands. Using pre/post-commit/rewrite/merge hooks won't guarantee it's correct e.g. if bypassing them if there checks in there that should be skipped)
There should be an easy way to force a specific timezone - or in absence of that at least force UTC - to prevent this