git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to determine the number of unique recent committers on a branch?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 23, 2022, 14:47 UTC
Message-ID
<220323.86bkxwogxs.gmgdl@evledraar.gmail.com>
In-Reply-To
<CAHGBnuMRKhsF-xCL944KD5GFPWYe-9cSp6FBZfaZ7bdVTkgjng@mail.gmail.com>
On Wed, Mar 23 2022, Sebastian Schuberth wrote:
Show 13 quoted lines
> On Wed, Mar 23, 2022 at 1:33 PM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>
>> I think --since to "rev-list" combined with e.g. "shortlog" is what you
>> want here, e.g. on git.git:
>>
>>         $ git -P shortlog --since=2.weeks.ago -sn origin/master
>
> But that still interprets "2.weeks.ago" relative to today, right? So,
> for a repo to which no one committed to in the last 2 weeks, it would
> show nothing. But what I'd like to get is the number of committers
> since 2 weeks before the latest commit. Any idea how to get that
> easily?
Ah, sorry. I managed to (mis)read your question.

Perhaps there's a way to do that in one command, but I don't think so, but I may be wrong.

But you *can* do by grabbing the epoch from the tip commit and doing some basic shell-math on it:

    git log --since=$(($(git log --oneline -1 --date=unix --pretty=format:%ad origin/master) - $((60*60*24*7*2)) )) origin/master
It would be nice if we had some option to to do that, e.g.:
    git log --since=2.weeks.ago --date-now=February.2018
Or To get you things in late January 2018. Or even:
    git -c core.time="February.2018" log --since=2.weeks.ago

To fool the entirety of git to use a given time() as current (but of course it would also need to "adjust back" commit dates for relative --since).

I'm 99% sure we don't have that, especially from looking at some of the code just now. But in the meantime you can hack it as above.

Previous: Sebastian SchuberthNext: Sebastian Schuberth
Message 4 of 6 in “How to determine the number of unique recent committers on a branch?”
  1. Sebastian SchuberthMar 23, 2022
  2. Ævar Arnfjörð BjarmasonMar 23, 2022
  3. Sebastian SchuberthMar 23, 2022
  4. Ævar Arnfjörð BjarmasonMar 23, 2022
  5. Sebastian SchuberthMar 23, 2022
  6. Junio C HamanoMar 23, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.