gogit
Generic, dependency-light Git ergonomics for Go, by shelling out to the
git CLI. The base layer for higher-level tools — including the bundled
gitscan CLI and the OmniDevX telemetry collectors — in the same way
gogithub underlies GitHub
integrations.
Library
- Discovery —
Discover(roots, maxDepth)finds repositories under directory roots without descending into them. - Commit log —
Repo.Logparses commits with calendar-date filtering, author/committer identities, subjects, trailers (Commit.CoAuthors()forCo-authored-by), and--numstatchange stats. - Incremental ingestion —
LogOptions.SinceCommitlimits output to commits after a given SHA (sha..HEAD) for high-water-mark workflows. - Reverse order —
LogOptions.Reversereturns commits oldest-first. - AI authorship —
AnalyzeAuthorshipdetects AI coding assistants (Claude Code, GitHub Copilot, Gemini CLI, Cursor, Aider) fromCo-authored-bytrailers, extracting tool names and model identities. - AI co-author parsing —
Commit.AICoAuthors()identifies AI tools from co-author trailers with model version extraction (e.g., "Sonnet 4"). - Commit stats by category —
Repo.CollectCommitStatsandAggregateCommitStatsaggregate commit counts and LOC by conventional- commit type, with AI-assisted metrics per tool and model. - Conventional commits —
ParseConventionalCommitextracts type, scope, breaking flag, and subject from conventional commit messages. - Trailer lookup —
Commit.TrailerValueandTrailerValuesprovide case-insensitive access to any trailer key. - Parallel execution —
RunAllandRunAllWithProgressexecute operations across multiple repositories concurrently with configurable worker count and context cancellation. - Metadata —
Repo.Branch,Repo.OriginURL,NormalizeRemoteURL(canonicalhost/pathidentifiers),Repo.Tags,Repo.TagsWithDates.
repo, _ := gogit.Open("/path/to/repo")
commits, _ := repo.Log(ctx, gogit.LogOptions{
Since: weekStart,
IncludeStats: true,
})
for _, c := range commits {
attr := gogit.AnalyzeAuthorship(c)
fmt.Println(c.Hash, attr.Tools, c.Insertions)
}
Install:
go get github.com/grokify/gogit
gitscan CLI
Scan many repositories for ones needing attention: uncommitted or
unpushed changes, replace directives, module/directory mismatches,
dependency filters, release ordering, and workflow compliance.
go install github.com/grokify/gogit/cmd/gitscan@latest
See the README for full CLI usage, and Releases for version history.