Show HN:用 Git 记录个人时间
Show HN: Personal Time Tracking with Git

原始链接: https://doocot.sh/blog/2025/03/28/time-tracking-with-git

时间追踪常常被认为是一种负担,但对开发者而言,如果用于自我提升,它却能成为强大的工具。通过客观衡量代码实现(从创建分支到合并)所花费的时间,开发者可以深入了解自己的工作流程和系统熵。 与主观估计不同,这些数据突显了进行更改的实际工作量,排除了规划时间。随着时间的推移,异常和趋势就会显现出来,从而能够就生产力进行知情的讨论。例如,团队可以追踪像AI这样的新工具对编码速度的影响,或者识别出越来越难以维护的组件。 这种方法侧重于创建可维护的软件,避免增加熵,从而加快开发节奏。通过将时间追踪用于自我分析,开发者可以优化流程,提高效率,并构建更可持续的代码库。

Hacker News 上的一篇文章重点介绍了一个名为“doocot.sh”的个人时间追踪工具,该工具由 thisdougb 使用 Git 开发。其目标是准确测量用于特性开发的时间,因为 thisdougb 不喜欢传统的预先估计。该方案利用 Git hook 来追踪提交的时间。 thisdougb 正在寻求 Git 专家们的反馈,特别是关于改进 pre-push hook 和实现相同目标的替代方法。目前的实现依赖于保留的 squash 提交文本,这可能是一个改进点。 jarbus 对该项目表示了热情。thisdougb 正在探索如何使该系统适应 GitHub 的 pull requests,但他需要更多关于 PR 流程中平台底层机制的知识。

原文

Knowing how much time is spent changing code in component x, lets us reason about entropy in the system. Showing your team mates that your swanky new AI co-worker enables you to be faster, could help you improve overall team productivity. Maybe you want to see if you're more effective when using Vim or VSCode, how else could you know than measuring over time?

Time-tracking as a fuzzy element of over-zealous Agile management turns many of us off. But when time-tracking is a tool developers can use for their own benefit, I’m all in for that.

Measure Beats Estimate

Good software development is not about making perfect software. It is about making software that’s good enough for the purpose, for maintainabilty, while not increasing entropy. Neglecting those last two is leaving free development cadence on the table.

It's taken a lot of trial and error to find a measure that feels a genuine reflection of time spent 'writing code'. While at the same time wrapped in a process that doesn't add any overhead.

My measurement spans from creating a new branch to merging that branch. A git hook automatically writes a log of the time taken to an annotated tag. That time is, objectively, how long I spent on implementation.

Now, bear in mind that this is still a vague measure of development time. But it's definitely less vague than guessing before starting the work. It’s meant to highlight the effort of making a change, excluding engineering/thinking time. All things being relatively equal, over a longer period, anomilies pop out.

Anomolies and trends in the data are things we can talk about in practical terms. Such as, “since we started using AI, average branch time is 10% less.” Or, “component X is getting progressively slower to maintain.”

联系我们 contact @ memedata.com