sourcerer-mike/git-time

此包的最新版本(v0.3.0)没有可用的许可信息。

v0.3.0 2018-01-17 18:17 UTC

This package is auto-updated.

Last update: 2024-09-21 00:09:14 UTC


README

  • 这个功能要花多少钱? git time src/feature/path
  • 我今天做了什么? git time --me -v --since=yesterday
  • 我们都开票了吗? git time -v --since="end of last month"

使用 -v 会显示每个提交花费的时间的表格。

安装

最好作为全局composer包使用

composer global require sourcerer-mike/git-time

# Do you have your composer bin accessible? If not ...
echo 'PATH=$PATH:~/.config/composer/vendor/bin' >> ~/.bashrc

或者每个项目本地安装(composer require sourcerer-mike/git-time:dev-master)。你可能想将 ~/.config/composer/vendor/bin/ 添加到Bash中的PATH变量中 ;)

估算项目或功能所需的时间

检查你花了多长时间?

git-time estimate src/my-feature/foo.php

# or for a specific time range
git-time estimate 13ea7dd..HEAD

# or both
git-time estimate 13ea7dd..HEAD  src/my-feature/foo.php

# for a particular time range (e.g. today) and a single author(maybe for you to clock at work)
git-time estimate -v --since 00:00 --author "Mike Pretzlaw"

结果将以表格形式显示

+---------+------------------+------------------------------------------+-------------+-------------+
| Hash    | Date             | Message                                  | Duration    | Cumulated   |
+---------+------------------+------------------------------------------+-------------+-------------+
| 18b978f | 2016-05-23 21:51 | initial empty commit                     |          1m |          1m |
| feced85 | 2016-05-24 07:52 | Estimate taken time with max cap         |         30m |         31m |
| d2c50ce | 2016-05-24 08:20 | Fetch parent commits                     |         28m |         59m |
| d21fd09 | 2016-05-24 08:38 | Calculate time related to parent commit. |         19m |      1h 18m |
+---------+------------------+------------------------------------------+-------------+-------------+

可能是全部。我错过了什么吗?

它是如何工作的

想象你运行 git time -v 在这些提交上

Initial commit              second                 third          fourth
            |                  |                     |               |
            |--- 10 minutes ---|------ ~7 days ------|-- 3 minutes --|
            |                  |                     |               |
last week 12:00              12:10           today 10:20           10:23
            |                  |                     |               |
            |--- 10 minutes ---|---- 30 minutes -----|-- 3 minutes --|
            |                  |  limited to maximum |               |
 Total of 43 minutes

限制可以通过 git time --max=60(分钟)更改,还有更多关于这个的内容

  • **初始提交** 本身将计为 **一分钟**。你不需要很长时间来打开一个GIT仓库。如果这样,可以通过 --no-parent-time 修改此时间,并将其设置为小时,如果你花这么长时间的话 ;)
  • 从 **初始提交** 到 **第二个**,你花了 **10分钟**。这没问题,我们将其添加,现在总共有11分钟。
  • 但从 **第二个** 到 **第三个**,你睡着了,一周(或一天)后继续工作。这是一个跨天的时间间隔,但 git-time 将其限制为 **30分钟**。如果你不喜欢这个限制,可以通过 --max 选项更改它。
  • 最后一个和 **第四个** 提交很容易。只是比上一个提交后 **3分钟**,这使得整个项目总共44分钟。相当小。

提供 -v 标志将为你提供一个更干净、更美观的视图

+---------+------------------+----------------------+-------------+-------------+
| Hash    | Date             | Message              | Duration    | Cumulated   |
+---------+------------------+----------------------+-------------+-------------+
| 18b978f | yesterday 12:00  | initial empty commit |          1m |          1m |
| feced85 | yesterday 12:10  | second               |         10m |         11m |
| d2c50ce | today 10:20      | third                |         30m |         41m |
| d21fd09 | today 10:23      | fourth               |          3m |         44m |
+---------+------------------+----------------------+-------------+-------------+