How to get all authors for current state of git?

IANAL, but as for the relicensing I am not so sure that it is enough to have only the permission of the authors who have any code in the current project. After all their contributions / commits somehow lead to the current state of the project.

That aside you may want to take a look at git blame. It shows what line of a file was introduced in which commit by which author. This should get you closer to the solution of your problem. Maybe some additional post processing with awk ... | sort | uniq can do the rest.

However, git blame only shows information for a single file, so you would have to repeat that for all files in the repository.

In the root directory of the Git repository, you could use a shell command like this on Linux systems:

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

This searches for C++ source files (extension *.cpp) with find and performs a git blame on all of those files. The option --show-email of git blame shows e-mail addresses instead of names, which are easier to filter for, because names can consist of several words, while an address is usually just one. awk then gets only the third column of the output, which is the mail address. (First is the short commit hash, second one is the file name.) Finally, sort | uniq is used to get rid of duplicates, showing each address only once.

(Untested, but it may point you in the right direction.)

If you just want every author who ever comitted anything to the repository, just use

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

instead.

Tags:

Git