{"id":21366005,"url":"https://github.com/goutte/git-spend","last_synced_at":"2025-07-13T04:32:23.222Z","repository":{"id":147722923,"uuid":"618670555","full_name":"Goutte/git-spend","owner":"Goutte","description":"Sum the time-tracking \"/spend\" commands of commit messages.","archived":false,"fork":false,"pushed_at":"2024-04-06T18:19:26.000Z","size":268,"stargazers_count":11,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-06T19:23:49.144Z","etag":null,"topics":["binary","cli","git","git-addons","git-commands","golang","spending-tracker","time-tracking","tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Goutte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-03-25T02:15:08.000Z","updated_at":"2024-04-06T19:23:51.439Z","dependencies_parsed_at":"2023-11-11T10:26:32.916Z","dependency_job_id":"3e0ad4b0-5267-4f43-9e71-4c6d01c4bc23","html_url":"https://github.com/Goutte/git-spend","commit_stats":null,"previous_names":["goutte/gitime"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Goutte%2Fgit-spend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Goutte%2Fgit-spend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Goutte%2Fgit-spend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Goutte%2Fgit-spend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Goutte","download_url":"https://codeload.github.com/Goutte/git-spend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225855953,"owners_count":17534967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","cli","git","git-addons","git-commands","golang","spending-tracker","time-tracking","tool"],"created_at":"2024-11-22T07:13:25.618Z","updated_at":"2024-11-22T07:13:26.205Z","avatar_url":"https://github.com/Goutte.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-spend : time tracker using git commit message commands\n=======================================================\n\n[![MIT](https://img.shields.io/github/license/Goutte/git-spend?style=for-the-badge)](LICENSE)\n[![Release](https://img.shields.io/github/v/release/Goutte/git-spend?include_prereleases\u0026style=for-the-badge)](https://github.com/Goutte/git-spend/releases)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/Goutte/git-spend/go.yml?style=for-the-badge)](https://github.com/Goutte/git-spend/actions/workflows/go.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Goutte/git-spend?style=for-the-badge)](https://app.codecov.io/gh/Goutte/git-spend/)\n[![A+](https://img.shields.io/badge/go%20report-A+-brightgreen.svg?style=for-the-badge)](https://goreportcard.com/report/github.com/Goutte/git-spend)\n[![Code Quality](https://img.shields.io/codefactor/grade/github/Goutte/git-spend?style=for-the-badge)](https://www.codefactor.io/repository/github/Goutte/git-spend)\n[![Download](https://img.shields.io/github/downloads/Goutte/git-spend/total?style=for-the-badge)](https://github.com/Goutte/git-spend/releases/latest/download/git-spend)\n\n\nPurpose\n-------\n\nCollect, addition and return all the `/spend` and `/spent` time-tracking directives in git commit messages.\n\n\u003e This looks at the `git log` of the currently checked out branch of the working directory,\n\u003e and therefore requires `git` to be installed on your system.\n\n**TLDR; JUST [DOWNLOAD LINUX/MAC] — [DOWNLOAD WINDOWS]**\n\n[DOWNLOAD LINUX/MAC]: https://github.com/Goutte/git-spend/releases/latest/download/git-spend\n[DOWNLOAD WINDOWS]: https://github.com/Goutte/git-spend/releases/latest/download/git-spend.exe\n\n\n### By Example\n\nSay you are in the directory of a project with one commit like so :\n\n```\nfeat(crunch): implement a nice feature\n\nCareful, it's still sharp.\n/spend 10h30\n```\n\nRunning:\n```\n$ git spend sum\n```\nwould yield:\n\u003e `1 day 2 hours 30 minutes`\n\nOf course, _git-spend_ really shines when you have multiple commits with `/spend` commands that you want to tally and sum.\n\n\u003e 💡 You can use `git-spend sum` or `git spend sum`, they are equivalent. \n\n### Specifications\n\nWe assume `8` hours per day, `5` days per week, `4` weeks per month. _(like Gitlab does)_\nThese can be configured at runtime if needed, using environment variables.\n\nThe **complete specification** can be found in [the rules](./gitime/gitime_test_data.yaml) of the test data,\nand in excruciating detail in [the grammar](./gitime/grammar.go).\n\nThe [acceptance testing suite](./test/features.bats) also holds many usage examples.\n\n\nUsage\n-----\n\nGo into your git-versioned project's directory:\n\n```\ncd \u003csome git versioned project with commits using /spend directives\u003e\n```\n\nand run:\n\n```\ngit spend sum\n```\n\u003e `2 days 1 hour 42 minutes`\n\nOr run `git-spend` from anywhere, but specify the `--target` directory (which defaults to `.`):\n\n```\ngit spend sum --target \u003csome git versioned project dir\u003e\n```\n\u003e `2 days 1 hour 42 minutes`\n\n\n\u003e ⛑ Use `git spend sum --help` or `man git-spend-sum` to see all the options.\n\u003e Meanwhile, let's look at some available options, below.\n\n\n### Format the output\n\nYou can get the spent time in a specific unit :\n\n```\ngit spend sum --minutes\ngit spend sum --hours\ngit spend sum --days\n```\n\u003e These values will always be rounded to integers, for convenience,\n\u003e although _git-spend_ does understand floating point numbers in `/spend` directives.\n\n\n### Filter by commit authors\n\nYou can track the time of specified authors only, by `name` or `email` :\n\n```\ngit spend sum --author Alice --author bob@email.net\n```\n\n\n### Exclude merge commits\n\nYou can also exclude merge commits :\n\n```\ngit spend sum --no-merges\n```\n\n\n### Restrict to a range of commits\n\nYou can restrict to a range of commits, using a commit hash, a tag, or even `HEAD~N`.\n\n```\ngit spend sum --since \u003cref\u003e --until \u003cref\u003e\n```\n\nFor example, to get the time spent on the last `15` commits :\n\n```\ngit spend sum --since HEAD~15\n```\n\nOr the time spent on a tag since previous tag :\n\n```\ngit spend sum --since 0.1.0 --until 0.1.1\n```\n\nYou can also use _dates_ and _datetimes_, but remember to quote them if you specify the time:\n\n```\ngit spend sum --since 2023-03-21\ngit spend sum --since \"2023-03-21 13:37:00\"\n```\n\n\u003e 📅 Other supported time formats: [`RFC3339`], [`RFC822`], [`RFC850`].\n\u003e If you need a specific timezone, try setting the `TZ` environment variable:\n\u003e `TZ=\"Europe/Paris\" git-spend sum --since 2023-03-21`\n\n[`RFC3339`]: https://www.rfc-editor.org/rfc/rfc3339\n[`RFC822`]: https://www.w3.org/Protocols/rfc822/\n[`RFC850`]: https://www.rfc-editor.org/rfc/rfc850\n\n\nDownload\n--------\n\n### Direct download\n\nYou can [⮋ download the binary](https://github.com/Goutte/git-spend/releases/latest/download/git-spend) straight from the [latest build in the releases](https://github.com/Goutte/git-spend/releases),\nand move it anywhere in your `$PATH`, such as `/usr/local/bin/git-spend` for example.\n\n\u003e ⚠ Remember to enable the execution bit with `chmod u+x ./git-spend`, for example.\n\nThere is an _experimental_ install script that does exactly this, plus `man` pages generation:\n\n    curl https://raw.githubusercontent.com/Goutte/git-spend/main/install.sh | sh\n\n\u003e 🐧 This script only works for `linux/amd64`, for now.   _Stigmergy?_\n\n### Via `go get`\n\nYou can also install via `go get` (hopefully) :\n\n```\ngo get -u github.com/goutte/git-spend\n```\n\nor `go install`:\n\n```\ngo install github.com/goutte/git-spend\n```\n\n\u003e If that fails, you can install by cloning and running `make install`.\n\n\nAdvanced Usage\n--------------\n\n### Read from standard input\n\nYou can also directly parse messages from `stdin`\ninstead of attempting to read the git log:\n\n```\ngit log \u003e git.log\ncat git.log | git-spend sum --stdin\n```\n\n\u003e `git spend` ignores standard input otherwise.\n\n\n### Configure the time modulo\n\nIf you live somewhere where work hours per week are limited (to 35 for example)\nin order to mitigate labor oppression tactics from monopoly hoarders,\nyou can use environment variables to control how time is \"rolled over\" between units :\n\n```\nGIT_SPEND_HOURS_PER_DAY=7 git-spend sum\n```\n\nHere are the available environment variables :\n\n- `GIT_SPEND_MINUTES_PER_HOUR` (default: `60`)\n- `GIT_SPEND_HOURS_PER_DAY` (default: `8`)\n- `GIT_SPEND_DAYS_PER_WEEK` (default: `5`)\n- `GIT_SPEND_WEEKS_PER_MONTH` (default: `4`)\n\n\n### Install the man pages\n\nIf you installed via direct download, you might want to install the `man` pages:\n\n```\nsudo git spend man --install\n```\n\n\u003e `git help spend` will then work as expected.\n\n\n\nDevelop\n-------\n\nFirst, you'll need to [install Golang](https://go.dev/dl/).\n\n```\ngit clone https://github.com/Goutte/git-spend.git\ncd git-spend\ngo get\ngo run main.go\n```\n\n\nBuild \u0026 Run \u0026 Install\n---------------------\n\nThe binaries in the releases are built by our [Continuous Integration](./.github/workflows/release.yml).\n\nNevertheless, if you want to build your own `git-spend`, you can clone this project and run: \n\n```\nmake\nmake install\n```\n\n\u003e [`upx`] is used to reduce the binary size in `make install-release`.\n\n[`upx`]: https://upx.github.io/\n\n---\n\nYou can compare the checksums, and they should be the same unless microsoft is being naughty.\n\n\n### Build for other platforms\n\nYou may use the `GOOS` and `GOARCH` environment variables to control the build targets:\n\n```\nGOOS=\u003ctarget-OS\u003e GOARCH=\u003ctarget-architecture\u003e go build -o build/git-spend .\n```\n\nTo list available targets (`os`/`arch`), you can run:\n\n```\ngo tool dist list\n```\n\n\u003e There's an example in the [`Makefile`], with the recipe `make build-windows-amd64`.\n\n[`Makefile`]: ./Makefile\n\nContribute\n----------\n\nMerge requests are welcome.  Make sure you record the time you `/spend` in your commit messages.  :)\n\n### Translations\n\nTranslations files are in `locale/*.toml`.\nTo add another language, add a new file, some sugar, some water, and … _voilà !_\n\n### Ideas Stash\n\n\u003e You can pick and start any, or do something else entirely.\n\u003e If you don't like any of these, please voice your concerns as early as possible.\n\n- [x] `curl install.sh | sudo sh` _(ongoing, wider support needed)_\n- [x] i18n _(ongoing, [cobra forked](https://github.com/Goutte/cobra/tree/feat-i18n))_\n- [ ] `git-spend sum --format \u003ccustom format\u003e`\n- [ ] `git-spend sum --short` → `1d3h27m`\n- [ ] `git-spend chrono start` → start an internal chronometer\n- [ ] `git-spend chrono add` → add time to the chronometer\n- [ ] Rewriting of `/spend chrono [± \u003cduration\u003e]` by commit hook\n- [ ] Rewriting of `/spend \u003cref\u003e [± \u003cduration\u003e]` by commit hook 🌟\n- [ ] `git spend hook --install` to install git hooks for rewriting\n- [ ] `git spend hook --remove` to remove installed git hooks\n- [ ] `git-spend amend \u003cduration\u003e` → amend previous commit with `/spend \u003cduration\u003e`\n- [ ] `git-spend amend --add \u003cduration\u003e` → same but adds\n- [ ] `git-spend amend --subtract \u003cduration\u003e` → same but subtracts  (alias: `--sub` ?)\n- [ ] docker _(`docker run git-spend` -- awkward? ; would need a volume)_\n- [ ] flatpak perhaps (road blocked, see [`packaging/`](./packaging))\n- [ ] Right-To-Left _(ساعد)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoutte%2Fgit-spend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoutte%2Fgit-spend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoutte%2Fgit-spend/lists"}