npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

git-dev-time

v1.2.1

Published

Calculate an estimate of time a git user spend on a repository

Downloads

12

Readme

git-dev-time

Calculate an estimate of the time a user spend on a repository.

git-dev-time gives you various stats about users from a Git repository:

  • Total number of commits
  • Timeframe in which the commits have been made
  • Estimated time spend on the project (based on when commits have been made)
  • Number of programming sessions the user made (based on when commits have been made)
  • Estimate, how much that work would have cost when paying by hours

This CLI was originally created to retroactively give an estimate of how many hours I needed to complete a project. Please don't actually use this to bill your client - this method is very inacturate in telling how much time you've actually spent and should only give a general area.

Example:

$ git-dev-time vantezzen Gert invalidUser
User "vantezzen" commited 184 times between 13/11/2019 and 24/02/2020 and spend ca. 2:11:19:31 (DD:HH:MM:SS) in 52 sessions on this repository.
With an hourly wage of $70 this would cost $4200.

User "Gert" commited 124 times between 01/12/2019 and 24/02/2020 and spend ca. 1:21:21:46 (DD:HH:MM:SS) in 35 sessions on this repository.
With an hourly wage of $70 this would cost $3220.

All selected users combined commited 308 commits and spend ca. 4:8:41:17 (DD:HH:MM:SS) in 87 sessions on this repository.
With an hourly wage of $70 this would cost $7350.

In order for the CLI to calculate the time spend on the repository, it will simply calculate the time between commits.

Installation

In order for git-dev-time to work, you'll have to have NodeJS with npm and the Git CLI installed on your computer first.

Using npx

Simply execute

npx git-dev-time <usernames...>

in a directory that contains a Git repository. Replace <usernames...> with a list of usernames you want the stats for (see Usage below for more information).

Installing the CLI globally

Alternatively you can install the CLI globally using npm or yarn

npm i -g git-dev-time

You can then execute the CLI using

git-dev-time <usernames...>

in a directory that contains a Git repository.

Installing the CLI locally

You can also clone this repository and install its dependencies using

npm install

You can then execute the CLI using

npm start <usernames...>

When installing the CLI locally you probably want to use the --directory (-d) flag to set a path to a Git repository outside the current one.

Usage

Usage: git-dev-time [options] <usernames...>

Calculate an estimate of time a git user spend on a repository

Options:
  -V, --version                   output the version number
  -m, --max-duration <duration>   Maximum duration in minutes between two commits in order to count as one session (default: 3h = 180)
  -d, --directory <directory>     Directory of the git repository (default: "./")
  -n, --no-days                   Only calculate the total hours and don't calculate days
  -s, --session-begin <duration>  Number of minutes to add to each session (default: 0)
  -a, --all                       Check on all branches
  -w, --wage <wage>               Hourly wage (to calculate cost of the work) (default: 70)
  -h, --help                      output usage information

Examples:

git-dev-time vantezzen # Get stats for user "vantezzen"
git-dev-time vantezzen notch # Get stats for user "vantezzen" and user "notch"
git-dev-time vantezzen -d /usr/home/me/repositories/example # Get stats for user "vantezzen" for the Git repository that's inside the directory

CLI behaviour

Users that have never commited will be ignored and nothing will be output. When trying to get stats for a directory that doesn't contain a Git repository, an error will be thrown.

The CLI will use the username contained in the commit itself - this isn't always the GitHub/GitLab/etc. username! Please check the Git log to see the Git username a developer used.

You don't necessarily have to run the CLI in the root directory in order for it to detect your Git repository. git-dev-time uses the Git command under the hood which allows you to execute it in any subdirectory of your Git repository.

If you get stats for multiple users, the CLI will also print a combined summary.

--all

By default, git-dev-time will only use commits on the current branch. If you want to use commits from all branches, supply the --all argument.

Sessions

There is a duration threshold between commits (--max-duration): If this threshold is reached, the time between the commits will not be counted (e.g. to not count the times when the developer has slept or took a longer break).

These blocks of commits are called "sessions". You can specify a number of minutes that should be added for each session, e.g. to accommodate for the time spend before the first commit of a session was made, using --session-begin.

License

This project is licensed under the MIT License.