Question

So I know this awesome script to display the contributors of my repo with their associated number of commits:

#!/bin/sh
git log --no-merges "$@" | grep ^Author: | sed 's/ <.*//; s/^Author: //' | sort | uniq -c | sort -nr

But now I'm interested in a script that would do exactly the same thing, but only from a certain range of checkpoints (for example: since tag XYZ to master branch HEAD).

How could I do this?

Was it helpful?

Solution

You can use git log with range of commits:

git log sha1..sha2

Probably will work for tags too.

OTHER TIPS

You should define the range as "commit-ish..commit-ish" in the command. Commit-ish means "commit id or tag name or branch name or HEAD"

Between commits:

#!/bin/sh
git log ff46a5..e567a98 --no-merges "$@" | grep ^Author: | sed 's/ <.*//; s/^Author: //' | sort | uniq -c | sort -nr

Between tags and branches (labels):

#!/bin/sh
git log MyTag..HEAD --no-merges "$@" | grep ^Author: | sed 's/ <.*//; s/^Author: //' | sort | uniq -c | sort -nr
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top