git_commit_count_since: Count commits in a repository since a date

View source: R/heartbeat.R

git_commit_count_sinceR Documentation

Count commits in a repository since a date

Description

Returns the number of commits on HEAD dated on or after since_date, and 0L for anything that is not a git working tree (plain directories, missing paths). Worktrees and dubious-ownership repositories are handled: a git rev-parse check runs first, and git's non-zero exits never leak as warnings. The counting primitive behind heartbeat, exported for downstream tooling that composes its own activity reports.

Usage

git_commit_count_since(repo_dir, since_date)

Arguments

repo_dir

Path to a repository.

since_date

A Date (or string in YYYY-MM-DD form). Commits from 00:00 local time on this date count.

Value

Integer commit count.

Examples

# A plain directory is not a repository: counts as zero
git_commit_count_since(tempdir(), Sys.Date() - 7)

saber documentation built on Nov. 10, 2026, 9:06 a.m.