Giter Site home page Giter Site logo

samber / git-contrib-graph Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 11.0 79 KB

๐Ÿ“Š Displays a github-like contribution graph, of every contributors of a repository

Dockerfile 2.33% Go 93.88% Shell 3.79%
contribution graph github git gitlab repository university epitech cli tool

git-contrib-graph's Introduction

Git contrib graph

Displays a github-like contribution graph, of every contributors of a repository: example.

Why

I've been developing this tool for getting a fast overview of student involvement in scholar group projects, at Epitech (French university).

Usage

$ 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.

$ git-contrib-graph --git-remote https://github.com/samber/invoice-as-a-service \
	--full-graph \
	--interval month

Repo: 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.

$ 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

$ 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)

git-contrib-graph's People

Contributors

citizen428 avatar clickyotomy avatar danieldantedossantosviana avatar dependabot[bot] avatar edenriquez avatar korrat avatar samber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

git-contrib-graph's Issues

Setup some basics unit tests

easy:

  • getTotalsByAuthor(),
  • getPlusMinusProgression(),
  • getDateLimits(),
  • getIntervalContribs()

medium:

  • getInitialCommitStats()
  • getConfig()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.