{"thread":{"id":"64195","subject":"0-Based indexes for git log","startedAt":"2025-09-23T21:15:55Z","lastAt":"2025-09-25T13:25:20Z","messageCount":17,"participants":["𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","Ben Knoble","Jeff King","Nico Williams","Junio C Hamano","Emily Shaffer","Patrick Steinhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"527139","messageId":"fd7758e5-7719-4bed-b1b3-2137c49cc950@velocifyer.com","threadId":"64195","inReplyTo":null,"subject":"0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-23T21:15:46Z","receivedAt":"2025-09-23T21:15:55Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":"In git log it uses a 1-based index for the date instead of a 0 based \nindex. So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \n\"Fri Sep 18 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24 \n(-4:00.00)\"  to get a better format)\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\n"},{"id":"527168","messageId":"2FAD09B7-4776-483E-90F1-31B031DAC2CA@gmail.com","threadId":"64195","inReplyTo":"fd7758e5-7719-4bed-b1b3-2137c49cc950@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-09-24T02:12:42Z","receivedAt":"2025-09-24T02:12:54Z","isPatch":false,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> Le 23 sept. 2025 à 17:16, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 <velocifyer@velocifyer.com> a écrit :\n> \n> ﻿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)\n\nAre these date formats locale-specific? In both the US English and France French locales I use commonly, the 19th of September in 2025 _is_ a Friday. Showing 18 would only be confusing."},{"id":"527173","messageId":"20250924052216.GB1173044@coredump.intra.peff.net","threadId":"64195","inReplyTo":"fd7758e5-7719-4bed-b1b3-2137c49cc950@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-09-24T05:22:16Z","receivedAt":"2025-09-24T05:22:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 23, 2025 at 05:15:46PM -0400, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 wrote:\n\n> In git log it uses a 1-based index for the date instead of a 0 based index.\n> So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \"Fri Sep 18\n> 14:23:24 2025 -0400\"\n\nAre you proposing that the first day of September is the 0th? You might\nbe able to do that with locale support and using strftime's %c option,\nbut I'm not sure how powerful locales are (or how one even defines\nthem).\n\n> (or \"Friday 2025-8-18 14:23:24 (-4:00.00)\"  to get a\n> better format)\n\nIf you just care about the format, check out the --date option in\ngit-log's manpage. Especially the \"format:\" specifier, which relies on\nstrftime, like:\n\n  git log --date=format:'%A %Y-%m-%d %H:%M:%S (%z)'\n\n-Peff\n"},{"id":"527210","messageId":"55e313f2-8ec3-4f6c-afe9-19d938e3a605@velocifyer.com","threadId":"64195","inReplyTo":"20250924052216.GB1173044@coredump.intra.peff.net","subject":"Re: 0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-24T13:42:21Z","receivedAt":"2025-09-24T13:42:30Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":"[sent again because i didn`t reply all\n> Are you proposing that the first day of September is the 0th? You might\n> be able to do that with locale support and using strftime's %c option,\n> but I'm not sure how powerful locales are (or how one even defines\n> them).\n\nNo, i am sugesting that it is still the 1st but it is september 0\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\nRemember to reply all on mailing lists (this is here so i don't forget \nto use reply all)(If you are reading this i forgot to remove it)\n"},{"id":"527211","messageId":"27456c8a-25f4-40f2-a791-efd35457d121@velocifyer.com","threadId":"64195","inReplyTo":"2FAD09B7-4776-483E-90F1-31B031DAC2CA@gmail.com","subject":"Re: 0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-24T13:46:44Z","receivedAt":"2025-09-24T13:46:51Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":"> Are these date formats locale-specific? In both the US English and France French locales I use commonly, the 19th of September in 2025 _is_ a Friday. Showing 18 would only be confusing.\n\nShowing 19 confuses me because i'm used to 0-based indexes where the \n19th is labeld as 18. Showing 18 would not cunfuse most people.\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\nRemember to reply all on mailing lists (this is here so i don't forget \nto use reply all)(If you are reading this i forgot to remove it)\n"},{"id":"527224","messageId":"B4B7BB74-9B69-4CDB-B4F2-FFB976A5B0CA@gmail.com","threadId":"64195","inReplyTo":"27456c8a-25f4-40f2-a791-efd35457d121@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-09-24T15:26:13Z","receivedAt":"2025-09-24T15:26:26Z","isPatch":false,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> Le 24 sept. 2025 à 09:46, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 <velocifyer@velocifyer.com> a écrit :\n> \n> ﻿\n>> \n>> Are these date formats locale-specific? In both the US English and France French locales I use commonly, the 19th of September in 2025 _is_ a Friday. Showing 18 would only be confusing.\n> \n> Showing 19 confuses me because i'm used to 0-based indexes where the 19th is labeld as 18. Showing 18 would not cunfuse most people.\n\nI would need evidence of that. Everyone I interact with agrees to write « 19 » when « 19th » is implied.\n\nAs I asked: is this particular to an community? I’m genuinely curious if there are groups or cultures that communicate this way. \n\nAs Peff points out, you can probably make commands display your own personal preference (or a locale should handle this for your community). But I don’t think this is something we can force on other people, because it would be confusing. "},{"id":"527228","messageId":"aNQRoMgSRVvNtStG@ubby","threadId":"64195","inReplyTo":"fd7758e5-7719-4bed-b1b3-2137c49cc950@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"Nico Williams","fromEmail":"nico@cryptonector.com","sentAt":"2025-09-24T15:43:28Z","receivedAt":"2025-09-24T15:52:27Z","isPatch":false,"sender":{"key":"nico@cryptonector.com","avatar":null},"body":"On Tue, Sep 23, 2025 at 05:15:46PM -0400, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 wrote:\n> In git log it uses a 1-based index for the date instead of a 0 based index.\n> So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \"Fri Sep 18\n> 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24 (-4:00.00)\"  to get a\n> better format)\n\nDay of month numbers are 1-based.\n"},{"id":"527230","messageId":"xmqqh5wrn66m.fsf@gitster.g","threadId":"64195","inReplyTo":"aNQRoMgSRVvNtStG@ubby","subject":"Re: 0-Based indexes for git log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-24T16:53:05Z","receivedAt":"2025-09-24T16:53:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nico Williams <nico@cryptonector.com> writes:\n\n> On Tue, Sep 23, 2025 at 05:15:46PM -0400, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 wrote:\n>> In git log it uses a 1-based index for the date instead of a 0 based index.\n>> So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \"Fri Sep 18\n>> 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24 (-4:00.00)\"  to get a\n>> better format)\n>\n> Day of month numbers are 1-based.\n\nCorrect.\n\nThere are a few things in Git that are 0 based, but not so many.\n\n * parent numbers are 1-based.  HEAD~1 is the \"previous commit\", aka\n   \"first parent\".  HEAD~0 is the HEAD itself.\n\n * merge parent numbers are 2-based (sanity of this statement is\n   already questionable).  If HEAD is a merge, HEAD~2 is the\n   \"(first) side branch that was merged\", HEAD~3 is the \"(second)\n   side brnach that was merged (in an octopus merge), and so on.\n\n * reflog entries are 1-based.  @{1} is the \"previous object pointed\n   by the current branch\", @{2} is one before that.  @{0} is the\n   current branch itself.\n\n * stash entries are counted 0-based.  \"git stash list\" shows from\n   stash@{0} that is the most recently created stash entry.\n\n\n\n\n"},{"id":"527232","messageId":"75860b99-b7b5-4398-b32f-47a4873508aa@velocifyer.com","threadId":"64195","inReplyTo":"aNQRoMgSRVvNtStG@ubby","subject":"Re: 0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-24T17:01:30Z","receivedAt":"2025-09-24T17:01:42Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":"> Day of month numbers are 1-based.\n\nI consider day of month to use a 0-based index\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\n"},{"id":"527234","messageId":"771fc44e-32d4-4758-b497-bcef86433446@velocifyer.com","threadId":"64195","inReplyTo":"xmqqh5wrn66m.fsf@gitster.g","subject":"Re: 0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-24T17:11:35Z","receivedAt":"2025-09-24T17:11:49Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":">> Day of month numbers are 1-based.\n> Correct.\nNo, day of month numbers are 0-based.\n> There are a few things in Git that are 0 based, but not so many.\n>\n>   * parent numbers are 1-based.  HEAD~1 is the \"previous commit\", aka\n>     \"first parent\".  HEAD~0 is the HEAD itself.\nHEAD~1 just means HEAD - 1 commit.(AKA \"reverse 0-based index\")\n>   * reflog entries are 1-based.  @{1} is the \"previous object pointed\n>     by the current branch\", @{2} is one before that.  @{0} is the\n>     current branch itself.\nNo, that is just a reverse 0-based index.\n>   * stash entries are counted 0-based.  \"git stash list\" shows from\n>     stash@{0} that is the most recently created stash entry.\n\nThat is correct. It's a reverse 0-based index becuase it uses reflog syntax.\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\n"},{"id":"527235","messageId":"f1599790-b48c-4c37-8cf7-4756f5064d2e@velocifyer.com","threadId":"64195","inReplyTo":"fd7758e5-7719-4bed-b1b3-2137c49cc950@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-24T17:15:02Z","receivedAt":"2025-09-24T17:15:07Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":"> In git log it uses a 1-based index for the date instead of a 0 based \n> index. So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \n> \"Fri Sep 18 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24 \n> (-4:00.00)\"  to get a better format)\n>\nI suggest git adds a config option for 0-based date and automaticly uses \n0-based date if there is a file at $HOME/use-0-based-index-for-date or \n$USE-0-BASED-INDEX-FOR-DATE == true\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\n"},{"id":"527236","messageId":"0fdd4ba0-f2e2-487b-9da0-686645c426e2@velocifyer.com","threadId":"64195","inReplyTo":"fd7758e5-7719-4bed-b1b3-2137c49cc950@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣","fromEmail":"velocifyer@velocifyer.com","sentAt":"2025-09-24T17:18:29Z","receivedAt":"2025-09-24T17:18:38Z","isPatch":false,"sender":{"key":"velocifyer@velocifyer.com","avatar":null},"body":"[resending because i made a typo]\n\n> In git log it uses a 1-based index for the date instead of a 0 based \n> index. So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \n> \"Fri Sep 18 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24 \n> (-4:00.00)\"  to get a better format)\n>\nI suggest git adds a config option for 0-based date and automatically \nuses 0-based date if there is a file at \n$HOME/.config/use-0-based-index-for-date or $USE-0-BASED-INDEX-FOR-DATE \n== true\n\n-- \nGeorge truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\nThis email does not constitute a legally binding contract\n"},{"id":"527238","messageId":"CAJoAoZkhqF83gsT963X81zZZi0wvYV9umEoXaArVpan6nDCoDg@mail.gmail.com","threadId":"64195","inReplyTo":"f1599790-b48c-4c37-8cf7-4756f5064d2e@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"Emily Shaffer","fromEmail":"nasamuffin@google.com","sentAt":"2025-09-24T17:22:16Z","receivedAt":"2025-09-24T17:22:30Z","isPatch":false,"sender":{"key":"nasamuffin@google.com","avatar":"https://avatars.githubusercontent.com/u/1606826?v=4"},"body":"On Wed, Sep 24, 2025 at 10:15 AM 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\n<velocifyer@velocifyer.com> wrote:\n>\n> > In git log it uses a 1-based index for the date instead of a 0 based\n> > index. So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say\n> > \"Fri Sep 18 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24\n> > (-4:00.00)\"  to get a better format)\n> >\n> I suggest git adds a config option for 0-based date and automaticly uses\n> 0-based date if there is a file at $HOME/use-0-based-index-for-date or\n> $USE-0-BASED-INDEX-FOR-DATE == true\n\nGit uses strftime from libc for date formatting. strftime[1] doesn't\noffer a way to format the date as you prefer - what you're asking for\nappears to be a personal preference, not a standard in any community\nof the world. I think that your best bet would be to attempt to\ncontribute an option to strftime to render the day of the month from\n0-30, but I would be surprised if such a contribution were to be\nwelcomed - as, again, this looks like a preference held by very few.\nBased on my quick refresher through date.[ch] in the Git codebase, it\nwould be infeasible to add such a flag and custom formatting.\n\nHowever, Git is open source software, and you're fully welcome to\npatch your copy of Git to accept such a config (or this ~/some-file,\nwhich is not a way Git typically sets configuration) and build it\nyourself locally.\n\n1: https://www.man7.org/linux/man-pages/man3/strftime.3.html\n>\n> --\n> George truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣\n> This email does not constitute a legally binding contract\n"},{"id":"527239","messageId":"95F22D6A-38D9-4F4D-B71E-59320B86B4E8@gmail.com","threadId":"64195","inReplyTo":"xmqqh5wrn66m.fsf@gitster.g","subject":"Re: 0-Based indexes for git log","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-09-24T17:28:31Z","receivedAt":"2025-09-24T17:28:43Z","isPatch":false,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> Le 24 sept. 2025 à 12:53, Junio C Hamano <gitster@pobox.com> a écrit :\n> \n> ﻿Nico Williams <nico@cryptonector.com> writes:\n> \n>>> On Tue, Sep 23, 2025 at 05:15:46PM -0400, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 wrote:\n>>> In git log it uses a 1-based index for the date instead of a 0 based index.\n>>> So it says \"Fri Sep 19 14:23:24 2025 -0400\" when it should say \"Fri Sep 18\n>>> 14:23:24 2025 -0400\" (or \"Friday 2025-8-18 14:23:24 (-4:00.00)\"  to get a\n>>> better format)\n>> \n>> Day of month numbers are 1-based.\n> \n> Correct.\n> \n> There are a few things in Git that are 0 based, but not so many.\n> \n> * parent numbers are 1-based.  HEAD~1 is the \"previous commit\", aka\n>   \"first parent\".  HEAD~0 is the HEAD itself.\n> \n> * merge parent numbers are 2-based (sanity of this statement is\n>   already questionable).  If HEAD is a merge, HEAD~2 is the\n>   \"(first) side branch that was merged\", HEAD~3 is the \"(second)\n>   side brnach that was merged (in an octopus merge), and so on.\n\nHEAD^2, 3, etc., rather? :)"},{"id":"527241","messageId":"aNQkrF1k4ZCj4h9Q@ubby","threadId":"64195","inReplyTo":"75860b99-b7b5-4398-b32f-47a4873508aa@velocifyer.com","subject":"Re: 0-Based indexes for git log","fromName":"Nico Williams","fromEmail":"nico@cryptonector.com","sentAt":"2025-09-24T17:04:44Z","receivedAt":"2025-09-24T17:41:16Z","isPatch":false,"sender":{"key":"nico@cryptonector.com","avatar":null},"body":"On Wed, Sep 24, 2025 at 01:01:30PM -0400, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 wrote:\n> > Day of month numbers are 1-based.\n> \n> I consider day of month to use a 0-based index\n\nThe rest of the world does not.  You want to be able to interoperate\nwith the rest of the world.  So day of month numbers are 1-based.  I\nalso wish everything were 0-based, but it's not.  That's just life.\n"},{"id":"527284","messageId":"aNTXRRolcqn5sT6d@pks.im","threadId":"64195","inReplyTo":"95F22D6A-38D9-4F4D-B71E-59320B86B4E8@gmail.com","subject":"Re: 0-Based indexes for git log","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-09-25T05:46:45Z","receivedAt":"2025-09-25T05:46:52Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Sep 24, 2025 at 01:28:31PM -0400, Ben Knoble wrote:\n> > * merge parent numbers are 2-based (sanity of this statement is\n> >   already questionable).  If HEAD is a merge, HEAD~2 is the\n> >   \"(first) side branch that was merged\", HEAD~3 is the \"(second)\n> >   side brnach that was merged (in an octopus merge), and so on.\n> \n> HEAD^2, 3, etc., rather? :)\n\nProbably. I also always regarded this as the nth parent, not the nth\nmerge parent. HEAD^1 returns the first parent even for non-merges,\nHEAD^2 the second and so on. So I'd claim these are also 1-based.\n\nPatrick\n"},{"id":"527324","messageId":"xmqqcy7eis02.fsf@gitster.g","threadId":"64195","inReplyTo":"95F22D6A-38D9-4F4D-B71E-59320B86B4E8@gmail.com","subject":"Re: 0-Based indexes for git log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-25T13:25:17Z","receivedAt":"2025-09-25T13:25:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ben Knoble <ben.knoble@gmail.com> writes:\n\n>> * merge parent numbers are 2-based (sanity of this statement is\n>>   already questionable).  If HEAD is a merge, HEAD~2 is the\n>>   \"(first) side branch that was merged\", HEAD~3 is the \"(second)\n>>   side brnach that was merged (in an octopus merge), and so on.\n>\n> HEAD^2, 3, etc., rather? :)\n\nThanks for correcting me.  Yes.  And HEAD^1 is the first parent that\nis the same as HEAD~1.\n"}]}