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, 12:30 UTC
Message-ID
<220323.86o81wonlf.gmgdl@evledraar.gmail.com>
In-Reply-To
<CAHGBnuPavzr_gq0ake6bOQETmHBnU2XOWdDz-UtkBP_+rRdYfA@mail.gmail.com>
On Wed, Mar 23 2022, Sebastian Schuberth wrote:
Show 23 quoted lines
> Hi,
>
> I'm trying to determine the number of unique committers who have
> recently committed to a branch. "Recently" should be configurable, but
> for my example I'll use a period of 3 months.
>
> At first, I thought the [<refname>]@{<date>} syntax [1] in conjunction
> with git "shortlog -s" could be helpful here, like
>
> $ git shortlog -s main@{3.months.ago} | wc -l
>
> But then I realized that just like with the --since option, the <date>
> counts relative to the current date, not relative to the date of the
> last commit on the given branch. To me, that's rather counterintuitive
> for the [<refname>]@{<date>} syntax.
>
> So, what would be a good way to achieve what I want with only
> Git-means (and maybe `wc`), but without any awk / Perl scripting
> magic?
>
> Thanks in advance!
>
> [1]: http://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltrefnamegtltdategtemegemmasteryesterdayememHEAD5minutesagoem

The ref@{} syntax will give you ref*log* times, which is probably not what you want.

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 
	    36  Junio C Hamano
	    12  Derrick Stolee
	     2  Shubham Mishra
	     1  Michael J Gruber
	     1  Ævar Arnfjörð Bjarmason

Maybe there's a way to get it to spew that out without the numeric summary, but I can't recall one offhand. I.e. you'd still need awk/cut, but at least not uniq anymore..

Previous: Sebastian SchuberthNext: Sebastian Schuberth
Message 2 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.