Skip to content

A command-line tool that helps you summarize and pretty-print collaborators based on contributions

License

Notifications You must be signed in to change notification settings

pioy/git-fame-rb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-fame

Gem Gitter Travis Coveralls My personal webpage

git-fame is a command-line tool that helps you summarize and pretty-print collaborators in a git repository based on contributions.

Example output

Statistics generated from this git repository using git fame .

Statistics based on master
Active files: 21
Active lines: 967
Total commits: 109

Note: Files matching MIME type image, binary has been ignored

+----------------+-----+---------+-------+---------------------+
| name           | loc | commits | files | distribution (%)    |
+----------------+-----+---------+-------+---------------------+
| Linus Oleander | 914 | 106     | 21    | 94.5 / 97.2 / 100.0 |
| f1yegor        | 47  | 2       | 7     |  4.9 /  1.8 / 33.3  |
| David Selassie | 6   | 1       | 2     |  0.6 /  0.9 /  9.5  |
+----------------+-----+---------+-------+---------------------+

Installation

[sudo] gem install git_fame

Usage

Command-line

From a git repository run git fame .

Options

  • git fame --by-type Group line counts by file extension (i.e. .rb, .erb, .yml). See the by type section below.
  • git fame --exclude=path1/*,path2/* Comma separated, glob file path to exclude.
  • git fame --include=path1/*,path2/* Comma separated, glob file path to include.
  • git fame --sort=loc Order table by loc. Available options are: loc, files and commits. Default is loc.
  • git fame --hide-progressbar Hide progressbar.
  • git fame --whitespace Ignore whitespace changes when blaming files. More about git blame and whitespace.
  • git fame --repository=/path/to/repo Git repository to be used. Default is the current folder.
  • git fame --branch=master Branch to run on. Default is what HEAD points to.
  • git fame --format=output Output format. Default is pretty. Additional: csv.
  • git fame --after=2010-01-01 Only use commits after this date. Format: yyyy-mm-dd. Note that the given date is included.
  • git fame --before=2016-02-01 Only use commits before this date. Format: yyyy-mm-dd. Note that the given date is included.
  • git fame --verbose Print shell commands used by git-fame.
  • git fame --everything Images and binaries are ignored by default. Include them as well.
  • git fame --timeout Set timeout in seconds for each git command.

By type

--by-type adds extra columns file types.

+----------------+-----+---------+-------+---------------------+---------+-----+----+---------+-----+
| name           | loc | commits | files | distribution (%)    | unknown | yml | md | gemspec | rb  |
+----------------+-----+---------+-------+---------------------+---------+-----+----+---------+-----+
| Linus Oleander | 914 | 106     | 21    | 94.5 / 97.2 / 100.0 | 32      | 5   | 61 | 23      | 257 |
| f1yegor        | 47  | 2       | 7     |  4.9 /  1.8 / 33.3  | 3       | 5   | 6  | 1       | 10  |
| David Selassie | 6   | 1       | 2     |  0.6 /  0.9 /  9.5  | 2       | 0   | 3  | 0       | 0   |
+----------------+-----+---------+-------+---------------------+---------+-----+----+---------+-----+

Programmatically

Want to work with the data before using it? Here's how.

Constructor arguments

options is a hash with most of the arguments passed to the binary defined above. Take a look at the bin/git-fame file for more information.

repository = GitFame::Base.new(options)

Print table

repository.pretty_puts outputs the statistics as an ascii table.

Print csv table to console

repository.csv_puts outputs the statistics as csv.

Statistics

GitFame
  • repository.loc (Fixnum) Total number of lines.
  • repository.commits (Fixnum) Total number of commits.
  • repository.files (Fixnum) Total number of files.
  • repository.authors (Array< Author >) All authors.
Author

author = repository.authors.first

  • Formated
    • author.loc (String) Number of lines.
    • author.commits (String) Number of commits.
    • author.files (String) Number of files changed.
  • Non formated
    • author.distribution (String) Distribution (in %) between users (loc/commits/files)
    • author.raw_loc (Fixnum) Number of lines.
    • author.raw_commits (Fixnum) Number of commits.
    • author.raw_files (Fixnum) Number of files changed.
    • author.file_type_counts (Array) File types (k) and loc (v)

Testing

  1. Download fixtures (spec/fixtures) using git submodule update --init.
  2. Run rspec using bundle exec rspec.

Note that puts has been disabled to avoid unnecessary output during testing. Visit spec/spec_helper.rb to enable it again.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Requirements

GitFame should work on all Unix based operating system with Git installed.

License

GitFame is released under the MIT license.

About

A command-line tool that helps you summarize and pretty-print collaborators based on contributions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%