It's a custom Git subcommand that attempts to answer a question: "How much code I have written and is STILL there?" Maybe it's just a dummy metric but it's fun :)
Let's take rails/rails repository as an example. At the moment I'm writing this text @dhh appears in second place in top contributors list. It makes totally sense since he has contributed a lot a long last years. But... How much of the code produced by him is STILL there? Well... At this moment his only in fourth place and owns 4.38% of the entire code.
$ git current-contributors -t 10
# 5.25% Aaron Patterson
# 5.03% Rafael Mendonça França
# 4.44% José Valim
# 4.38% David Heinemeier Hansson *
# 4.25% Xavier Noria
# 3.71% Jeremy Kemper
# 3.17% Yves Senn
# 3.09% Sean Griffin
# 3.06% Pratik Naik
# 2.99% Andrew White
Or in linux/kernel repository where Mr. Linus Torvalds appears in 26th place in top contributors list. However in the moment I'm writing this text he owns 15% of the (current) entire code. If you think is not too much he owns ~3 million lines of code while the second place owns about 0.5 million.
$ git current-contributors -t 10 -a
# 15.00% Linus Torvalds (3.000.000)
# 2.00% Some Great Developer (500.000)
Note: fix these values as soon as the script runs again :)
Note: It took about 24hs running but I was curious about it
Install consists in adding git-current-contributors file to your $PATH. There are a lot of ways of doing this but if you trust me here it follows a suggestion:
$ curl -sS https://raw.githubusercontent.com/moacirosa/git-current-contributors/master/install | bash
Note: Run a new shell session or run
source ~/.bashrc
if you can't
You can check if everything is fine running git help -a
:
...
git commands available from elsewhere on your $PATH
current-contributors
'git help -a' and 'git help -g' lists available subcommands and some
...
- Unix, MacOS
- Python2+
- Git
Just grab some repository and run the custom command:
$ git clone https://github.com/Seldaek/monolog.git
$ cd monolog
$ git current-contributors
# 29.95% Jordi Boggian
# 9.36% Christophe Coevoet
# 2.85% skymeyer
# 2.69% barbushin
# 2.32% Florian Plattner
# (...)
... or specifically within a tests
subfolder:
$ git current-contributors --path="tests"
# 26.85% Jordi Boggiano
# 9.37% Christophe Coevoet
# 3.85% skymeyer
# 3.43% Florian Plattner
# 3.23% barbushin
... or listing top 3 contributors in ASC order showing absolute number of lines:
$ git clone https://github.com/lodash/lodash.git
$ cd lodash
$ git current-contributors --top-n="3" --reverse --show-absolute
# 0.15% Xotic750 (174)
# 9.48% jdalton (11323)
# 89.49% John-David Dalton (106933)
... or sorting first ten contributors by name:
$ git current-contributors --top-n="10" --alphabetically
# 0.10% Graeme Yeates
# 9.48% jdalton
# 89.49% John-David Dalton
# 0.05% Justin Ridgewell
# 0.10% Mathias Bynens
# 0.08% Michał Lipiński
# 0.05% Milos Zivadinovic
# 0.05% octref
# 0.06% Ray Hammond
# 0.15% Xotic750
... or showing mail address of top five contributors:
$ git current-contributors --top-n="5" --identifier="author-mail"
# 98.96% <john.david.dalton@gmail.com>
# 0.15% <xotic750@gmail>
# 0.10% <yeatesgraeme@gmail.com>
# 0.10% <mathias@qiwi.be>
# 0.08% <michal.lipinski@cgmpolska.pl>
-h, --help
show this help message and exit
--path PATH
A path to be inspected that uses current directory as default
-r, --reverse
Sort in reversed order (can be combined with --alphabetically)
-s, --alphabetically
Sort alphabetically instead sorting by amount
-i {author,author-mail,committer,commiter-mail},
--identifier {author,author-mail,committer,commiter-mail}
Define the key used in parse process for fetching contributors
-a, --show-absolute
Print the absolute number of lines owned
-t TOP_N, --top-n TOP_N
Set max number of contributors for listing. Set -1 to unlimit output
-b, --force-binaries
Run blame over binaries files (not recommended)
--self-update
Update the command itself when updates are available
-v, --verbose
Increase verbosity
--version
Show program's version number and exit
- tj/git-extras GIT utilities -- repo summary, repl, changelog population, author commit percentages and more
Note: Some of them like Git Extra was used as reference during development of this one
Moacir Rosa - paulomoacir.junior@gmail.com - http://twitter.com/moacirosa
See also the list of contributors which participated in this project.
The content of this project itself is licensed under the Creative Commons Attribution 3.0 license, and the underlying source code used to format and display that content is licensed under the MIT license.