# git-commit-statistics

> Get commit log statistics of git repository

Latest version **2.0.0** (published 2019-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-commit-statistics
pnpm add git-commit-statistics
yarn add git-commit-statistics
bun add git-commit-statistics
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-09-15 |
| First published | 2018-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 3 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | YoshinoriN |
| Maintainers | yoshinorin |
| Keywords | git, log, commit, statistics |

## Links

- npm: https://www.npmjs.com/package/git-commit-statistics
- Repository: https://github.com/YoshinoriN/git-commit-statistics
- Homepage: https://github.com/YoshinoriN/git-commit-statistics#readme
- Issues: https://github.com/YoshinoriN/git-commit-statistics/issues
- npm.io page: https://npm.io/package/git-commit-statistics

## Dependencies (3)

- [lodash.sortby](https://npm.io/package/lodash.sortby.md) 4.7.0
- [lodash.groupby](https://npm.io/package/lodash.groupby.md) 4.6.0
- [lodash.toarray](https://npm.io/package/lodash.toarray.md) 4.4.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-09-15
- 1.0.1 — 2018-10-29
- 1.0.0 — 2018-10-28
- 0.3.0 — 2018-10-13
- 0.2.2 — 2018-10-13
- 0.2.1 — 2018-10-13
- 0.2.0 — 2018-10-13
- 0.1.0 — 2018-10-13

## README

# git-commit-statistics

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/700d8374e80a46e5b14e1b180e385507)](https://app.codacy.com/app/YoshinoriN/git-commit-statistics?utm_source=github.com&utm_medium=referral&utm_content=YoshinoriN/git-commit-statistics&utm_campaign=Badge_Grade_Settings)
[![NPM version](https://badge.fury.io/js/git-commit-statistics.svg)](https://www.npmjs.com/package/git-commit-statistics)
[![Build Status](https://travis-ci.org/YoshinoriN/git-commit-statistics.svg?branch=master)](https://travis-ci.org/YoshinoriN/git-commit-statistics) [![Coverage Status](https://coveralls.io/repos/github/YoshinoriN/git-commit-statistics/badge.svg?branch=master)](https://coveralls.io/github/YoshinoriN/git-commit-statistics?branch=master)

Get commit log statistics of git repository.

## Features

Can get belows statistics. Examples of result are [here](#examples-of-result).

* byPerDayOfMonth
* byPerMonth
* byPerWeekDays
* byPerYear
* byPerDayHour
* byDayHourOfWeekDay

## Installation

```sh
$ npm install git-commit-statistics
```

## Usaga

```js
const CommitStatistics = require('git-commit-statistics');

const cs = new CommitStatistics('<yourRepositoryPath>/.git');

//No options
let result = cs.getByPerDayOfMonth();

//With options
const options = {
  author: 'YoshinoriN',
  since: '2017-01-01',
  after: '2018-01-01',
  maxCount: 100,
  noMerges: true
};
let result = cs.getByPerDayOfMonth(options);
```

All available methods are belows.

|name|options|result|
|---|---|---|
|getByPerDayOfMonth()|[Options](#options)|[example](#getbyperdayofmonth)|
|getByPerMonth()|[Options](#options)|[example](#getbypermonth)|
|getByPerWeekDay()|[Options](#options)|[example](#getbyperweekday)|
|getByPerYear()|[Options](#options)|[example](#getbyperyear)|
|getByDayHour()|[Options](#options)|[example](#getbydayhour)|
|getByDayHourOfWeekDay()|[Options](#options)|[example](#getbydayhourofweekday)|

### Options

Input argument to each method. Example is below.

```js
const options = {
  author: 'YoshinoriN',
  maxCount: 100
};
let result = cs.getByPerDayOfMonth(options);
```

Allowable options for each methods argument.

|name|type|example|
|---|---|---|
|author|`string`|'YoshinoriN'|
|since|`string`|'2017-01-01'|
|after|`string`|'2018-01-01'|
|until|`string`|'2018-01-01'|
|before|`string`|'2018-01-01'|
|maxCount|`number`|100|
|noMerges|`boolean`|true|

Please see [official git document](https://git-scm.com/docs/git-log#_options) what is mean.

## Examples of Result

Example result of each methods.

### getByPerDayOfMonth

```js
[ { day: 1, count: 809 },
  { day: 2, count: 733 },
...
  { day: 30, count: 642 },
  { day: 31, count: 340 } ]
```

### getByPerMonth

```js
[ { id: 1, month: 'Jan', count: 2124 },
  { id: 2, month: 'Feb', count: 2147 },
...
  { id: 11, month: 'Nov', count: 1631 },
  { id: 12, month: 'Dec', count: 2110 } ]
```

### getByPerWeekDay

```js
[ { id: 0, dayOfWeek: 'Sun', count: 1891 },
  { id: 1, dayOfWeek: 'Mon', count: 3899 },
...
  { id: 5, dayOfWeek: 'Fri', count: 3765 },
  { id: 6, dayOfWeek: 'Sat', count: 1950 } ]
```

### getByPerYear

```js
[ { year: 2009, count: 915 },
  { year: 2010, count: 1945 },
...
  { year: 2017, count: 4610 },
  { year: 2018, count: 3429 } ]
```

### getByDayHour

```js
[ { hour: 0, count: 744 },
  { hour: 1, count: 671 },
...
  { hour: 22, count: 987 },
  { hour: 23, count: 938 } ]
```

### getByDayHourOfWeekDay

```js
{ id: 0,
  Sun:
   [ { hour: 11, count: 1 },
     { hour: 12, count: 1 },
     { hour: 23, count: 1 } ] }
{ id: 1,
  Mon:
   [ { hour: 8, count: 1 },
     { hour: 9, count: 3 },
...
     { hour: 20, count: 2 },
     { hour: 21, count: 1 } ] }
...
{ id: 5,
  Fri:
   [ { hour: 5, count: 4 },
     { hour: 7, count: 2 },
...
     { hour: 21, count: 1 } ] }
{ id: 6,
  Sat:
   [ { hour: 1, count: 2 },
     { hour: 4, count: 1 },
...
     { hour: 20, count: 1 },
     { hour: 21, count: 2 } ] }
```

## License

MIT

---
_Source: https://npm.io/package/git-commit-statistics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
