One-call repository introspection helpers that compose lower-level Git functions.
Provides convenient summaries of repository state, HEAD information, and remote details without requiring multiple manual calls.
All functions accept an optional keyword list. Use :config to specify the
repository via a Git.Config struct; when omitted a default config is built
from the environment.
Summary
Functions
Returns whether the repository has any uncommitted changes.
Returns current HEAD information.
Returns enriched remote information.
Returns the repository root path.
Returns a comprehensive repository overview.
Functions
Returns whether the repository has any uncommitted changes.
Checks for staged, modified, or untracked files.
Options
:config- aGit.Configstruct
Examples
{:ok, false} = Git.Info.dirty?()
Returns current HEAD information.
Includes the branch name, full SHA, and whether HEAD is detached.
Options
:config- aGit.Configstruct
Examples
{:ok, head} = Git.Info.head()
head.branch #=> "main"
head.detached #=> false
@spec remotes_detailed(keyword()) :: {:ok, [%{name: String.t(), fetch_url: String.t(), push_url: String.t()}]} | {:error, term()}
Returns enriched remote information.
Lists all remotes with their fetch and push URLs via git remote -v.
Options
:config- aGit.Configstruct
Examples
{:ok, remotes} = Git.Info.remotes_detailed()
hd(remotes).name #=> "origin"
hd(remotes).fetch_url #=> "https://github.com/owner/repo.git"
Returns the repository root path.
Wraps git rev-parse --show-toplevel.
Options
:config- aGit.Configstruct
Examples
{:ok, "/home/user/project"} = Git.Info.root()
Returns a comprehensive repository overview.
Composes status, rev-parse, remote, and log to produce a single map describing the current state of the repository.
Options
:config- aGit.Configstruct
Examples
{:ok, info} = Git.Info.summary()
info.branch #=> "main"
info.dirty #=> false
info.ahead #=> 0