← All posts

March 25, 2026·6 min read

How gitglimpse Estimates Effort from Git History

A deep dive into the heuristic algorithm that turns commit timestamps and diff sizes into reasonable effort estimates.

internals algorithms git

The problem with commit timestamps

A commit timestamp tells you when code was saved, not when work started. If you commit at 2:00 PM and your previous commit was at 11:00 AM, did you really work for three hours straight? Maybe. Or maybe you went to lunch, got pulled into a meeting, and only wrote code for forty-five minutes. gitglimpse uses a set of heuristics to make a reasonable guess.

The algorithm

The core logic is intentionally simple. For the first commit of the day, we assume 30 minutes of prior work — you likely read code, pulled changes, or thought about the problem before committing. For subsequent commits, we look at the gap between consecutive timestamps. If the gap is under 2 hours, we count the actual elapsed time. If it exceeds 2 hours, we cap the estimate at 45 minutes to account for interruptions. Finally, large diffs (200+ changed lines) get a 1.2× multiplier, and every task has a 15-minute floor so tiny fixes aren't trivialized.

python
def estimate_minutes(commits: list[Commit]) -> float:
    if not commits:
        return 0

    total = 30  # assume prior work for first commit

    for prev, curr in zip(commits, commits[1:]):
        gap = (curr.timestamp - prev.timestamp).total_seconds() / 60

        if gap <= 120:
            minutes = gap
        else:
            minutes = 45  # cap long gaps

        if curr.lines_changed >= 200:
            minutes *= 1.2  # large-diff multiplier

        total += max(minutes, 15)  # 15-min floor

    return round(total)

Why heuristics beat precision

No algorithm can perfectly reconstruct how you spent your day from commit data alone. But that's fine — the goal is a useful approximation, not an audit trail. In practice, these heuristics land within 10–15% of self-reported effort for most developers. That's accurate enough to answer "what did I do today?" without requiring you to run a stopwatch.

Edge cases and tuning

  • Squash merges — gitglimpse groups by author timestamp, so squashed commits still reflect the original work timeline.
  • Rebases — interactive rebases preserve author dates by default, so estimates remain accurate.
  • Pair programming — if two authors alternate commits rapidly, the gap-based model still works since each author's timeline is processed independently.
  • Configurable thresholds — you can override the 2-hour gap cap, the 1.2× multiplier, and the 15-minute floor in .gitglimpse.toml.
  • Noise filtering — merge commits, dependency updates, and formatting commits are excluded before estimation, so they don't inflate your effort numbers.