How to get all authors for the current state of git?

I tried to find all the authors of the git project so that I could ask about the retransmission of their commits. I thought that there would be no point in contacting all the authors, as there might have been some who had the code in the code base, but it was deleted. Therefore, I only wanted to contact authors who are visible in the current HEAD.

I was told that git log has this feature, but I could not find anything on it except something like:

git log --format='%an <%ae>'

Which does what I would like to achieve, except that it does not exclude authors without code in the current code base.

How can i achieve this?

+4
source share
3 answers

IANAL, relicensing, , , - . , / - .

git wame. , , . . , awk ... | sort | uniq .

git blame , .

Git , , Linux:

find ./ -name '*.cpp' -print0 | xargs -0 -i git blame --show-email {} | awk ' { print $3 } ' | sort | uniq

++ ( *.cpp) find git blame . --show-email of git blame , , , . awk , . ( - , - .) , sort | uniq , , .

(, .)

, , - - ,

git log --format='%an <%ae>' | sort | uniq

.

+4

git , :

#!/bin/sh

set -e

IFS='
'
for f in `git ls-tree -r --name-only ${1:-HEAD}`; do
        git blame -w -C -p "$f" | sed -n \
                -e '/^author /{ s/^author //; h; }' \
                -e '/^author-mail /{ s/^author-mail //; H; x; s/\n/ /p; }'
done | sort -u

-w, -C, , . , -p (.. .)

, -w -C , , .

+1

shortlog (. https://git-scm.com/docs/git-shortlog):

$ git shortlog -se
    26  Bart Simpson <elbarto@springfield.com>
     6  Homer Simpson <homer.j.simpson@springfield.com>
   103  Lisa Simpson <jazz@springfield.com>
    34  Marge Simpson <marge@springfield.com>

, , .

By default, it parses the story leading to HEAD, i.e. everything that leads to the current commit.
I think this is exactly what you want.

You can sort by commit account with -nto find out the most important committers.

$ git shortlog -sen
   103  Lisa Simpson <jazz@springfield.com>
    34  Marge Simpson <marge@springfield.com>
    26  Bart Simpson <elbarto@springfield.com>
     6  Homer Simpson <homer.j.simpson@springfield.com>
-1
source

Source: https://habr.com/ru/post/1655506/


All Articles