|
| 1 | +# GitBlame |
| 2 | + |
| 3 | +Who did what in your project? |
| 4 | +GitBlame generates som much needed statistics from your current git repository. |
| 5 | + |
| 6 | +## Output |
| 7 | + |
| 8 | +Example out from the [water project](https://github.com/water/mainline). |
| 9 | + |
| 10 | +``` |
| 11 | +Total number of files: 2,053 |
| 12 | +Total number of lines: 63,132 |
| 13 | +Total number of commits: 4,330 |
| 14 | ++------------------------+--------+---------+-------+----------------+ |
| 15 | +| name | loc | commits | files | percent | |
| 16 | ++------------------------+--------+---------+-------+----------------+ |
| 17 | +| Johan Sørensen | 22,272 | 1,814 | 414 | 35.3/41.9/20.2 | |
| 18 | +| Marius Mathiesen | 10,387 | 502 | 229 | 16.5/11.6/11.2 | |
| 19 | +| Jesper Josefsson | 9,689 | 519 | 191 | 15.3/12.0/9.3 | |
| 20 | +| Ole Martin Kristiansen | 6,632 | 24 | 60 | 10.5/0.6/2.9 | |
| 21 | +| Linus Oleander | 5,769 | 705 | 277 | 9.1/16.3/13.5 | |
| 22 | +| Fabio Akita | 2,122 | 24 | 60 | 3.4/0.6/2.9 | |
| 23 | +| August Lilleaas | 1,572 | 123 | 63 | 2.5/2.8/3.1 | |
| 24 | +| David A. Cuadrado | 731 | 111 | 35 | 1.2/2.6/1.7 | |
| 25 | +| Jonas Ängeslevä | 705 | 148 | 51 | 1.1/3.4/2.5 | |
| 26 | +| Diego Algorta | 650 | 6 | 5 | 1.0/0.1/0.2 | |
| 27 | +| Arash Rouhani | 629 | 95 | 31 | 1.0/2.2/1.5 | |
| 28 | +| Sofia Larsson | 595 | 70 | 77 | 0.9/1.6/3.8 | |
| 29 | +| Tor Arne Vestbø | 527 | 51 | 97 | 0.8/1.2/4.7 | |
| 30 | +| spontus | 339 | 18 | 42 | 0.5/0.4/2.0 | |
| 31 | +| Pontus | 225 | 49 | 34 | 0.4/1.1/1.7 | |
| 32 | ++------------------------+--------+---------+-------+----------------+ |
| 33 | +``` |
| 34 | + |
| 35 | +## Usage |
| 36 | + |
| 37 | +### Console |
| 38 | + |
| 39 | +Start by navigating to a git repository. |
| 40 | + |
| 41 | +#### Plain |
| 42 | + |
| 43 | +`git accuse` |
| 44 | + |
| 45 | +#### Order by a specific field |
| 46 | + |
| 47 | +Order by the amounts of current lines of code `loc`, the amounts of `commits` or author |
| 48 | + |
| 49 | +- `git accuse --order=loc` |
| 50 | +- `git accuse --order=commits` |
| 51 | +- `git accuse --order=author` |
| 52 | + |
| 53 | +Default is `loc`. |
| 54 | + |
| 55 | +### Class |
| 56 | + |
| 57 | +Want to work with the data before printing it? |
| 58 | + |
| 59 | +`repository = GitBlame.new` |
| 60 | + |
| 61 | +#### Order by |
| 62 | + |
| 63 | +The constructor takes a hash with arguments, one being the `order` key. |
| 64 | + |
| 65 | +`GitBlame.new({order: "loc"})` |
| 66 | + |
| 67 | +#### Print table to console |
| 68 | + |
| 69 | +`repository.pretty_print` |
| 70 | + |
| 71 | +### Statistics |
| 72 | + |
| 73 | +#### GitBlame |
| 74 | + |
| 75 | +- Total number of lines |
| 76 | + - `repository.loc` |
| 77 | +- Total number of commits |
| 78 | + - `repository.commits` |
| 79 | +- Total number of files |
| 80 | + - `repository.files` |
| 81 | +- All authors |
| 82 | + - `repository.authors` |
| 83 | + |
| 84 | +#### Author |
| 85 | + |
| 86 | +`author = repository.authors` |
| 87 | + |
| 88 | +- Number of lines |
| 89 | + - `author.loc` |
| 90 | +- Number of commits |
| 91 | + - `author.commits` |
| 92 | +- Number of files changed |
| 93 | + - `author.files` |
| 94 | +- Percent of total (loc/commits/files) |
| 95 | + - `author.percent` |
| 96 | + |
| 97 | +## Contributing |
| 98 | + |
| 99 | +1. Fork it |
| 100 | +2. Create your feature branch (`git checkout -b my-new-feature`) |
| 101 | +3. Commit your changes (`git commit -am 'Added some feature'`) |
| 102 | +4. Push to the branch (`git push origin my-new-feature`) |
| 103 | +5. Create new Pull Request |
0 commit comments