git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Sebastian Schuberth <sschuberth@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: How to determine the number of unique recent committers on a branch?
Date: Wed, 23 Mar 2022 13:30:50 +0100	[thread overview]
Message-ID: <220323.86o81wonlf.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CAHGBnuPavzr_gq0ake6bOQETmHBnU2XOWdDz-UtkBP_+rRdYfA@mail.gmail.com>


On Wed, Mar 23 2022, Sebastian Schuberth wrote:

> 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..

  reply	other threads:[~2022-03-23 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 10:23 How to determine the number of unique recent committers on a branch? Sebastian Schuberth
2022-03-23 12:30 ` Ævar Arnfjörð Bjarmason [this message]
2022-03-23 13:00   ` Sebastian Schuberth
2022-03-23 14:47     ` Ævar Arnfjörð Bjarmason
2022-03-23 22:14       ` Sebastian Schuberth
2022-03-23 20:48 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220323.86o81wonlf.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sschuberth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).