Skip to content

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

  • DiscoveryDiscover(roots, maxDepth) finds repositories under directory roots without descending into them.
  • Commit logRepo.Log parses commits with calendar-date filtering, author/committer identities, subjects, trailers (Commit.CoAuthors() for Co-authored-by), and --numstat change stats.
  • Incremental ingestionLogOptions.SinceCommit limits output to commits after a given SHA (sha..HEAD) for high-water-mark workflows.
  • Reverse orderLogOptions.Reverse returns commits oldest-first.
  • AI authorshipAnalyzeAuthorship detects AI coding assistants (Claude Code, GitHub Copilot, Gemini CLI, Cursor, Aider) from Co-authored-by trailers, extracting tool names and model identities.
  • AI co-author parsingCommit.AICoAuthors() identifies AI tools from co-author trailers with model version extraction (e.g., "Sonnet 4").
  • Commit stats by categoryRepo.CollectCommitStats and AggregateCommitStats aggregate commit counts and LOC by conventional- commit type, with AI-assisted metrics per tool and model.
  • Conventional commitsParseConventionalCommit extracts type, scope, breaking flag, and subject from conventional commit messages.
  • Trailer lookupCommit.TrailerValue and TrailerValues provide case-insensitive access to any trailer key.
  • Parallel executionRunAll and RunAllWithProgress execute operations across multiple repositories concurrently with configurable worker count and context cancellation.
  • MetadataRepo.Branch, Repo.OriginURL, NormalizeRemoteURL (canonical host/path identifiers), 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.