Estimate the amount of time spent working on a Git repository

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.

You might also like...
Repository for Public Impervious Releases

Impervious Releases This is the repository for impervious releases and supporting files and documentation. Binaries The binaries are now released and

Stacked branch management for Git
Stacked branch management for Git

git-stack Stacked branch management for Git Dual-licensed under MIT or Apache 2.0 Documentation About Installation Getting Started Reference FAQ Compa

Lintje is an opinionated linter for Git.

Lintje Lintje is an opinionated linter for Git. It lints commit messages based on a preconfigured set of rules focussed on promoting communication bet

Clean up the lines of files in your code repository

lineman Clean up the lines of files in your code repository NOTE: While lineman does have tests in place to ensure it operates in a specific way, I st

Replay git history with some tweaks

Git-replay Overview Git-replay is a simple tool that replays the history of a Git repository but with some tweaks (i.e., it can change the author name

A git hook to manage derivative files automatically.

git-derivative A git hook to manage derivative files automatically. For example if you checked out to a branch with different yarn.lock, git-derivativ

Simple and fast git helper functions

Simple and fast git helper functions

Verbump - A simple utility written in rust to bump and manage git semantic version tags.

Verbump - A simple utility written in rust to bump and manage git semantic version tags.

A git prepare-commit-msg hook for authoring commit messages with GPT-3.

gptcommit A git prepare-commit-msg hook for authoring commit messages with GPT-3. With this tool, you can easily generate clear, comprehensive and des

Comments
  • 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
Owner
null
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 268 Jan 6, 2023
A working example of multi targets compilation for Rust using Github Actions.

A working example of multi targets compilation for Rust using Github Actions. Supports Windows, MacOSX, x86_64, ARM and Raspberry PI Linux.

Nicolas Vanhoren 41 Dec 17, 2022
IDX is a Rust crate for working with RuneScape .idx-format caches.

This image proudly made in GIMP License Licensed under GNU GPL, Version 3.0, (LICENSE-GPL3 or https://choosealicense.com/licenses/gpl-3.0/) Contributi

Ceikry 5 May 27, 2022
Rust libraries for working with GPT (GUID Partition Table) disk data

gpt-disk-rs no_std libraries related to GPT (GUID Partition Table) disk data. There are three Rust packages in this repository: uguid The uguid packag

Google 25 Dec 24, 2022
A Rust utility library, making easier by taking the hassle out of working. :octocat:

reddish A Rust utility library, making easier by taking the hassle out of working. Usage Add this to your Cargo.toml: [dependencies] reddish = "0.2.0"

Rogério Araújo 12 Jan 21, 2023
Cargo wrapper for working with Webassembly wasi(x).

cargo-wasix A cargo subcommand that wraps regular cargo commands for compiling Rust code to wasix, a superset of Websassembly wasi with additional fun

WASIX 19 Jun 12, 2023
🌲 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 26 Dec 17, 2022
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 214 Dec 26, 2022
🌌⭐ 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 229 Dec 22, 2022
A small tool to clone git repositories to a standard location, organised by domain name and path.

A small tool to clone git repositories to a standard location, organised by domain name and path. Runs on BSD, Linux, macOS, Windows, and more.

Wesley Moore 68 Dec 19, 2022