Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samber/git-contrib-graph
📊 Displays a github-like contribution graph, of every contributors of a repository
https://github.com/samber/git-contrib-graph
cli contribution epitech git github gitlab graph repository tool university
Last synced: about 1 month ago
JSON representation
📊 Displays a github-like contribution graph, of every contributors of a repository
- Host: GitHub
- URL: https://github.com/samber/git-contrib-graph
- Owner: samber
- Created: 2018-10-08T10:37:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-30T13:18:13.000Z (8 months ago)
- Last Synced: 2024-05-02T01:13:58.334Z (8 months ago)
- Topics: cli, contribution, epitech, git, github, gitlab, graph, repository, tool, university
- Language: Go
- Homepage:
- Size: 83 KB
- Stars: 8
- Watchers: 3
- Forks: 11
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Git contrib graph
Displays a github-like contribution graph, of every contributors of a repository: [example](https://github.com/moby/moby).
## Why
I've been developing this tool for getting a fast overview of student involvement in scholar group projects, at [Epitech](http://epitech.eu) (French university).
## Usage
```sh
$ go get github.com/samber/git-contrib-graph$ git-contrib-graph
Usage of git-contrib-graph:
-full-graph
Display days without contributions
-git-path string
Fetch logs from local git repository (bare or normal)
-git-remote string
Fetch logs from remote git repository Github, Gitlab...
-interval string
Display contributions per day, week or month (default "day")
-json
Display json output contributions object
-max-columns int
Number of columns in your terminal or output (default 80)
-no-colors
Disabled colors in output
```## Example
Display contributions per week, with color and including weeks with no commit.
```sh
$ git-contrib-graph --git-remote https://github.com/samber/invoice-as-a-service \
--full-graph \
--interval monthRepo: https://github.com/samber/invoice-as-a-service
Contributions to master, excluding merge commits:
################################################################################
################################################################################Author: [email protected]
Total:
31 commits
Insertions: 7557 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Deletions: 127 ------------------------------------------------------------Per day:
2018-03-01 | 7063(+) 101(-) +++++++++++++++++++++++++++++++++++++++++++++++++-
2018-04-01 | 0(+) 0(-)
2018-05-01 | 0(+) 0(-)
2018-06-01 | 0(+) 0(-)
2018-07-01 | 494(+) 26(-) ++++++++++++++++++++++++++++++++++++++++++++++++---
2018-08-01 | 0(+) 0(-)
2018-09-01 | 0(+) 0(-)
2018-10-01 | 0(+) 0(-)################################################################################
################################################################################Author: [email protected]
Total:
4 commits
Insertions: 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Deletions: 25 -------------------------Per day:
2018-03-01 | 0(+) 0(-)
2018-04-01 | 0(+) 0(-)
2018-05-01 | 0(+) 0(-)
2018-06-01 | 0(+) 0(-)
2018-07-01 | 0(+) 0(-)
2018-08-01 | 0(+) 0(-)
2018-09-01 | 0(+) 0(-)
2018-10-01 | 121(+) 25(-) +++++++++++++++++++++++++++++++++++++++++---------################################################################################
################################################################################Author: [email protected]
Total:
1 commits
Insertions: 386 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Deletions: 359 ------------------------------------------------------------Per day:
2018-03-01 | 0(+) 0(-)
2018-04-01 | 0(+) 0(-)
2018-05-01 | 0(+) 0(-)
2018-06-01 | 0(+) 0(-)
2018-07-01 | 0(+) 0(-)
2018-08-01 | 0(+) 0(-)
2018-09-01 | 0(+) 0(-)
2018-10-01 | 386(+) 359(-) ++++++++++++++++++++++++++------------------------```
## Json Example
Display contributions per week, with color and including weeks with no commit, as JSON object.
```sh
$ git-contrib-graph --git-remote https://github.com/samber/invoice-as-a-service --json{"interval": "day", "contributors": [{"author": "[email protected]", "total": {"commits": 4, "insertions": 121, "deletions": 25}, "graph": []}, {"author": "[email protected]", "total": {"commits": 1, "insertions": 386, "deletions": 359}, "graph": [{"date": "2018-10-03", "add": 121, "sub": 25 }]}, {"author": "[email protected]", "total": {"commits": 31, "insertions": 7557, "deletions": 127}, "graph": [{"date": "2018-10-03", "add": 121, "sub": 25 }, {"date": "2018-10-02", "add": 386, "sub": 359 }]}]}
```
## Docker
Remote repository:
```
docker run --rm samber/git-contrib-graph \
--git-remote https://github.com/samber/invoice-as-a-service \
--interval week --full-graph
```Local repository:
```
docker run --rm \
-v /students/john-doe/project-a-b-c:/repo \
samber/git-contrib-graph \
--git-path /repo --interval week --full-graph
```## Todo
- image output
- custom branch
- clone on filesystem instead of memory
- test with lot of public github repo and compare contrib graphs
- better example in readme
- get graph for only one contributor## Contributing
âš Quick and dirty project ;)
### Run
```sh
$ go run git-contrib-graph.go --git-remote https://github.com/samber/invoice-as-a-service \
--full-graph \
--max-columns 100 \
--interval week...
```### About git api and go-git library
Git log command do much more things than you think !
- At low level, initial git commit does not have diff (because it has no parent). Then we fetch number of changes (add/del) based on number of lines.
- Merge commits have 2 parents. In that case, changes (add/del) are displayed once in `git log` command, but are provided twice in git api (in both original and merge commit)