Re: 0-Based indexes for git log
- From
Emily Shaffer <nasamuffin@google.com>
- Date
- Sep 24, 2025, 17:22 UTC
- Message-ID
- <CAJoAoZkhqF83gsT963X81zZZi0wvYV9umEoXaArVpan6nDCoDg@mail.gmail.com>
- In-Reply-To
- <f1599790-b48c-4c37-8cf7-4756f5064d2e@velocifyer.com>
On Wed, Sep 24, 2025 at 10:15 AM 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 <velocifyer@velocifyer.com> wrote:
Show 9 quoted lines
> > > In git log it uses a 1-based index for the date instead of a 0 based > > index. So it says "Fri Sep 19 14:23:24 2025 -0400" when it should say > > "Fri Sep 18 14:23:24 2025 -0400" (or "Friday 2025-8-18 14:23:24 > > (-4:00.00)" to get a better format) > > > I suggest git adds a config option for 0-based date and automaticly uses > 0-based date if there is a file at $HOME/use-0-based-index-for-date or > $USE-0-BASED-INDEX-FOR-DATE == true
Git uses strftime from libc for date formatting. strftime[1] doesn't offer a way to format the date as you prefer - what you're asking for appears to be a personal preference, not a standard in any community of the world. I think that your best bet would be to attempt to contribute an option to strftime to render the day of the month from 0-30, but I would be surprised if such a contribution were to be welcomed - as, again, this looks like a preference held by very few. Based on my quick refresher through date.[ch] in the Git codebase, it would be infeasible to add such a flag and custom formatting.
However, Git is open source software, and you're fully welcome to patch your copy of Git to accept such a config (or this ~/some-file, which is not a way Git typically sets configuration) and build it yourself locally.
1: https://www.man7.org/linux/man-pages/man3/strftime.3.html
> > -- > George truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 > This email does not constitute a legally binding contract