Estimate the amount of time spent working on a Git repository

Related tags

git rust cli statistics
Overview

jikyuu (時給)

A tool to estimate the amount of time spent working on a Git repository.

It is a direct port of git-hours, written in Node.js, because the code was many years out of date and no longer builds.

Note that the information provided is only a rough estimate.

Installation

cargo install jikyuu

Example

git clone https://github.com/twbs/bootstrap
cd bootstrap
jikyuu
+----------------+-------------------------+---------+-----------------+
| Author         | Email                   | Commits | Estimated Hours |
|                |                         |         |                 |
| Mark Otto      | [email protected]     | 2902    | 1808.9833       |
| Mark Otto      | [email protected]         | 2516    | 1709.4          |
| XhmikosR       | [email protected]      | 1431    | 1612.4667       |
| Chris Rebert   | [email protected]       | 945     | 1019.3          |
| Jacob Thornton | [email protected] | 826     | 740.35          |
| Mark Otto      | [email protected]    | 858     | 663.7167        |
| <...>          |                         |         |                 |
|                |                         |         |                 |
| Total          |                         | 16639   | 15041.153       |
+----------------+-------------------------+---------+-----------------+

You can associate an author that has used multiple emails in the commit logs with the --email (-e) option.

+-----------------+---------------------------+---------+-----------------+
| Author          | Email                     | Commits | Estimated Hours |
|                 |                           |         |                 |
| Mark Otto       | [email protected]       | 6880    | 4662.817        |
| XhmikosR        | [email protected]        | 1431    | 1612.4667       |
| Chris Rebert    | [email protected]         | 945     | 1019.3          |
| Jacob Thornton  | [email protected]   | 826     | 740.35          |
| Martijn Cuppens | [email protected] | 361     | 508.5           |
| <...>           |                           |         |                 |
+-----------------+---------------------------+---------+-----------------+

Use --format json (-f) to output the data as a JSON array.

[
  {
    "email": "[email protected]",
    "author_name": "Mark Otto",
    "hours": 4662.817,
    "commit_count": 6880
  },
  {
    "email": "[email protected]",
    "author_name": "XhmikosR",
    "hours": 1612.4667,
    "commit_count": 1431
  },

  // ...

  {
    "email": null,
    "author_name": "Total",
    "hours": 14826.803,
    "commit_count": 16639
  }
]

Algorithm

See the How it works section of the git-hours README.

Usage

Run the following command to estimate the time spent for the provided Git repository.

jikyuu /path/to/git/repo/

The path must point to the root of the Git repo, not any subdirectories inside of it.

Extended usage:

USAGE:
    jikyuu [FLAGS] [OPTIONS] 

FLAGS:
    -h, --help              Prints help information
    -m, --merge-requests    Include merge requests into calculation
    -V, --version           Prints version information

OPTIONS:
    -b, --branch                                                 Analyze only data on the specified branch
    -t, --branch-type 
            Type of branch that `branch` refers to. `local` means refs/heads/, `remote` means refs/remotes/.

    -e, --email ...
            Associate all commits that have a secondary email with a primary email

    -a, --first-commit-add 
            How many minutes first commit of session should add to total [default: 120]

    -f, --format 
             [default: stdout]  [possible values: Stdout, Json]

    -d, --max-commit-diff 
            Maximum difference in minutes between commits counted to one session [default: 120]

    -s, --since 
            Analyze data since certain date [default: always]

    -u, --until 
            Analyze data until certain date [default: always]


ARGS:
        Root path of the Git repository to analyze.

License

MIT.

Issues
  • inconsistency between js and rust implementation's output

    inconsistency between js and rust implementation's output

    Hey @Ruin0x11 thank you for this great work of re-implementing git-hours in Rust. Very much needed! I was looking forward for a fresh implementation of this great tool.

    Today I decided to give it a shot and test a bit and I found something odd. For instance, if we consider the repo https://github.com/grinfans/grinmw.py commit a08ccdecf0945d3a980c6e2c9495b747f9b7cfc3 and run both of them with same same --max-commit-diff numbers I find much different results

    jikyuu

    $ jikyuu -d 120 -f json
    [
      {
        "email": "[email protected]",
        "author_name": "xiaojay",
        "hours": 4.2,
        "commit_count": 10
      },
      {
        "email": "[email protected]",
        "author_name": "Blade Doyle",
        "hours": 1.05,
        "commit_count": 5
      },
      {
        "email": "[email protected]",
        "author_name": "marekyggdrasil",
        "hours": 0.36666667,
        "commit_count": 4
      },
      {
        "email": "[email protected]",
        "author_name": "ndcroos",
        "hours": 0.0,
        "commit_count": 1
      },
      {
        "email": null,
        "author_name": "Total",
        "hours": 5.616667,
        "commit_count": 20
      }
    ]
    

    git-hours

    $ git-hours -d 120
    {
      "[email protected]": {
        "name": "marekyggdrasil",
        "hours": 0,
        "commits": 4
      },
      "[email protected]": {
        "name": "ndcroos",
        "hours": 0,
        "commits": 1
      },
      "[email protected]": {
        "name": "Blade Doyle",
        "hours": 4,
        "commits": 5
      },
      "[email protected]": {
        "name": "xiaojay",
        "hours": 18,
        "commits": 14
      },
      "total": {
        "hours": 22,
        "commits": 24
      }
    }
    

    The total is far off! The Blade Doyle five commits are estimated by jikyuu to take 1.05 hours and according to git-hours they took 4 hours.

    Not saying your result is wrong. I think we should estimate which of the implementations is right!

    opened by marekyggdrasil 6
  • calculating daily work time

    calculating daily work time

    @Ruin0x11 following up on the feature suggestion https://github.com/Ruin0x11/jikyuu/issues/2

    Please note this is a work-in-progress, more commits are going to be added to this PR. Another disclaimer is, this is my first Rust code ever so please be gentle with the review ;P.

    opened by marekyggdrasil 4
  • feature idea: daily working hours

    feature idea: daily working hours

    I have an idea for a feature. I wanted to contribute it to git-hours but I was not able to build the dev mode (only install from npm).

    Idea is providing number of hours on each day, for example:

    [
      {
        "email": "[email protected]",
        "author_name": "John Doe",
        "hours": 12.817,
        "commit_count": 14,
        "breakdown": {
            "2021-04-27": 6.817,
            "2021-04-26": 6.0
        }
      },
      {
        "email": "[email protected]",
        "author_name": "Alice Bob",
        "hours": 21.4667,
        "commit_count": 18,
        "breakdown": {
            "2021-04-27": 7.4667,
            "2021-04-26": 6.0,
            "2021-04-25": 7.0,
            "2021-04-24": 1.0
        }
      },
      {
        "email": null,
        "author_name": "Total",
        "hours": 34.2837,
        "commit_count": 32
      }
    ]
    

    Motivation: Useful to evaluate hours for people who get paid in currencies that have daily price fluctuations, it would allow to make more accurate payment according to hourly rate with taking into account daily exchange rates.

    opened by marekyggdrasil 2
Rust implementation of the legacy Master Server Query Protocol

msq-rs Rust library implementation of the legacy Master Server Query Protocol. Documentation crates.io Repository Release Notes Usage Add this to your

mtcw 4 May 24, 2021
Async executor for WebAssembly

There are a number of async task executors available in Rust's ecosystem. However, most (if not all?) of them rely on primitives that might not be available or optimal for WebAssembly deployment at the time.

wasm.rs 28 May 25, 2021
transmute-free Rust library to work with the Arrow format

Arrow2: Transmute-free Arrow This repository contains a Rust library to work with the Arrow format. It is a re-write of the official Arrow crate using

Jorge Leitao 69 Jun 16, 2021
Utilities and tools based around Amazon S3 to provide convenience APIs in a CLI

s3-utils Utilities and tools based around Amazon S3 to provide convenience APIs in a CLI. This tool contains a small set of command line utilities for

Isaac Whitfield 33 May 18, 2021
Simple git/hg tui client focused on keyboard shortcuts

verco A simple Git/Hg tui client focused on keyboard shortcuts Screenshots Platforms This project uses Cargo and pure Rust stable and works on latest

Matheus Lessa Rodrigues 159 May 27, 2021
🌌⭐ Git tooling of the future.

❯ Glitter Git tooling of the future. ❯ ?? Features Config files Fast Easy to use Friendly errors ❯ ?? Documentation For proper docs, see here ❯ ✋ What

Milo 86 Jun 11, 2021
Concatenate Amazon S3 files remotely using flexible patterns

S3 Concat This tool has been migrated into s3-utils, please use that crate for future updates. A small utility to concatenate files in AWS S3. Designe

Isaac Whitfield 31 May 22, 2021
Czkawka is a simple, fast and easy to use app to remove unnecessary files from your computer.

Multi functional app to find duplicates, empty folders, similar images etc.

Rafał Mikrut 4.2k Jun 13, 2021
Simple ray tracer written in Rust

Simple ray tracer written in Rust from scratch I've just finished my first semester at the Faculty of Applied Mathematics and Computer Science at the

Vladislav 190 Jun 12, 2021
Astronomical algorithms in Rust

astro-rust Contents API Docs About Usage Contributing References About astro-rust is a library of advanced astronomical algorithms for the Rust progra

Saurav Sachidanand 154 Jun 9, 2021
🌲 Open the current remote repository in your browser

gitweb Some of the flags and options are subject to change in the future. Ideas are welcome. Ideas are bulletproof (V). gitweb is a command line inter

Yoann Fleury 20 May 25, 2021
Toolkit for working with scripts used by REDengine in Cyberpunk 2077.

redscript Toolkit for working with scripts used by REDengine in Cyberpunk 2077. Currently includes a compiler, a decompiler and a disassembler. usage

jac3km4 85 Jun 8, 2021
Migrate C code to Rust

C2Rust helps you migrate C99-compliant code to Rust. The translator (or transpiler) produces unsafe Rust code that closely mirrors the input C code. T

Immunant 1.9k Jun 13, 2021
RDFM - The Rusty DotFiles Manager

d8888b. d88888b. 8888888b 8888b d8888 88 `8D 88 `8D 88' 88'YbdP`88 88oobY' 88 88

Wafelack 39 May 21, 2021