• Stars
    star
    730
  • Rank 59,634 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Estimate time spent on a git repository

Status badge

git-hours

Estimate time spent on a git repository.

For example time spent on Twitter's Bootstrap

➜  bootstrap git:(master) git-hours
{

  ...

  "total": {
    "hours": 9959,
    "commits": 11470
  }
}

From a person working 8 hours per day, it would take more than 3 years to build Bootstrap.

Please note that the information might not be accurate enough to be used in billing.

Install

$ npm install -g git-hours

NOTE: If for some reason git-hours won't work, try to npm install -g nodegit.

git-hours depends on nodegit. It might be a bit tricky to install. If installing git-hours fails for some reason, probably it was because nodegit couldn't be installed. Check their documentation for troubleshooting.

How it works

The algorithm for estimating hours is quite simple. For each author in the commit history, do the following:



Go through all commits and compare the difference between them in time.




If the difference is smaller or equal then a given threshold, group the commits to a same coding session.




If the difference is bigger than a given threshold, the coding session is finished.




To compensate the first commit whose work is unknown, we add extra hours to the coding session.




Continue until we have determined all coding sessions and sum the hours made by individual authors.


The algorithm in ~30 lines of code.

Usage

In root of a git repository run:

$ git-hours

Note: repository is not detected if you are not in the root of repository!

Help

Usage: git-hours [options]

Options:

  -h, --help                                 output usage information
  -V, --version                              output the version number
  -d, --max-commit-diff [max-commit-diff]    maximum difference in minutes between commits counted to one session. Default: 120
  -a, --first-commit-add [first-commit-add]  how many minutes first commit of session should add to total. Default: 120
  -s, --since [since-certain-date]           Analyze data since certain date. [always|yesterday|tonight|lastweek|yyyy-mm-dd] Default: always'
  -e, --email [emailOther=emailMain]         Group person by email address. Default: none
  -u, --until [until-certain-date]           Analyze data until certain date. [always|yesterday|today|lastweek|thisweek|yyyy-mm-dd] Default: always
  -m, --merge-request [false|true]           Include merge requests into calculation.  Default: true
  -p, --path [git-repo]                      Git repository to analyze. Default: .
  -b, --branch [branch-name]                 Analyze only data on the specified branch. Default: all branches

Examples:

 - Estimate hours of project

     $ git-hours

 - Estimate hours in repository where developers commit more seldom: they might have 4h(240min) pause between commits

     $ git-hours --max-commit-diff 240

 - Estimate hours in repository where developer works 5 hours before first commit in day

     $ git-hours --first-commit-add 300

 - Estimate hours work in repository since yesterday

   $ git-hours --since yesterday

 - Estimate hours work in repository since 2015-01-31

   $ git-hours --since 2015-01-31

- Estimate hours work in repository on the "master" branch

   $ git-hours --branch master

For more details, visit https://github.com/kimmobrunfeldt/git-hours

More Repositories

1

progressbar.js

Responsive and slick progress bars
JavaScript
7,755
star
2

react-progressbar.js

Responsive and slick progress bars for React.
JavaScript
310
star
3

eink-weather-display

Battery-powered E-Ink weather display for our home.
C
252
star
4

url-to-image

PhantomJS screenshotting done right
JavaScript
204
star
5

howto-everything

Collection of notes and howtos. Questions / ideas -> please open an issue :) Also check my blog:
Shell
153
star
6

football-score-detector

Detect table football score from camera image with machine vision
Python
68
star
7

dont-copy-paste-this-frontend-template

Frontend template project to get you started with frontend development
JavaScript
55
star
8

express-example

Example of good Express.js architecture with Promises and nice error handling
JavaScript
55
star
9

nap

Convenient way to request HTTP APIs
Python
42
star
10

v8-profiler-trigger

Trigger CPU profile recording or heap snapshots for node apps using keyboard shortcuts.
JavaScript
28
star
11

squint

Makes visual reviews of web app releases easy.
TypeScript
26
star
12

releasor

Command line tool to automate node module releasing to NPM and Git
JavaScript
23
star
13

fix-outline

*:focus { outline: none } done right.
JavaScript
18
star
14

spawn-default-shell

Spawn shell command with platform default shell
JavaScript
12
star
15

ppmusicbot

Telegram bot which adds all linked Spotify track links to a shared playlist
JavaScript
8
star
16

dcr

Node CLI tool to decrypt partially encrypted log streams on the fly
JavaScript
8
star
17

iphone-x

Testing webgl. Based on https://github.com/PavelDoGreat/WebGL-Fluid-Simulation/
JavaScript
7
star
18

html5-pathfinder

Visualisation of path finding with canvas
JavaScript
7
star
19

promise-retryify

Add retry functionality to any Promise based library
JavaScript
6
star
20

shary.in

Mobile pastebin for images
JavaScript
5
star
21

blog

Personal blog at kimmo.blog
TypeScript
4
star
22

egtest

Test example code blocks in documentation
Python
4
star
23

rate-limiting-s3-proxy

Pass-through S3 proxy with rate limiting.
JavaScript
4
star
24

busse-release

Web version of real time bus tracking system in Tampere
JavaScript
4
star
25

concurrently

Moved under github.com/open-cli-tools/concurrently
4
star
26

labyrinth

Online version of the Labyrinth board game. The game server runs on the host's browser and networking happens peer-to-peer.
TypeScript
4
star
27

pair-coding-with-chatgpt

I paired up with ChatGPT to code a poker game with react
HTML
3
star
28

array-sort-compare

Generic type-aware compare function for Array.prototype.sort() and sortDeep.
JavaScript
3
star
29

kauko

Kauko is remote control for computer.
Python
3
star
30

shoot

UI review for web applications
JavaScript
3
star
31

bluetooth-web-api-talk

JavaScript
3
star
32

elegant-clock

Elegant analog clock
JavaScript
3
star
33

busse-web

Public transit real time on a map.
JavaScript
3
star
34

planter-docker

Dockerfile that packages planter and plantuml into a Docker image
Shell
3
star
35

lissu-proxy

Nicer JSON API for lissu.tampere.fi
JavaScript
3
star
36

service-worker-demo

Tiny demo of Service Worker
JavaScript
2
star
37

presentic

Impress your audience
JavaScript
2
star
38

drydoc

DRY documents
Python
1
star
39

random_python_utils

collection of snippets and functions
Python
1
star
40

mips-asm-calculator

Calculator
Assembly
1
star
41

arr-uniq

Generic array uniq function which supports equals predicate function
JavaScript
1
star
42

ocr-engine

Experimental OCR engine
Python
1
star
43

wave

Experimenting with canvas and paper.js
JavaScript
1
star
44

chokidar-cli

Moved to github.com/open-cli-tools/chokidar-cli
1
star
45

arr-mutations

Calculate all mutation operations between two arrays. Supports a generic equals predicate function
JavaScript
1
star
46

text-to-speech-hubot

JavaScript
1
star
47

how-much-oss-projects-are-worth-in-cash

How much open source projects are worth in cash.
JavaScript
1
star
48

busse-api

Busse API for all cities.
JavaScript
1
star
49

entangle

Screen share using Chrome without any installations or plugins.
JavaScript
1
star
50

react-scripts-antd

Fork of react-scripts to be used with http://ant.design
JavaScript
1
star
51

mozart

Convert any given text to music
JavaScript
1
star
52

tencalendar

Incredibly fast calendar for power users
JavaScript
1
star
53

portal

Real life portal controlled with Leap Motion
JavaScript
1
star
54

lodash-merge-pollution-example

Demonstration of _.merge prototype pollution vulnerability
JavaScript
1
star