Expand description
Provide lightweight Git helpers atop git2 plus selective fallbacks to the system git binary.
Wrap common operations (repo discovery, root resolution, status enumeration, branch listing,
targeted fetch, branch switching, restore) in focused functions returning structured data
(GitStatusEntry, branch::Branch). Some semantics (previous branch with switch -, restore) defer to
the porcelain CLI to avoid re‑implementing complex behavior.
Modules§
Structs§
- GitStatus
Entry - Combined staged + worktree status for a path
- Repository
- An owned git repository, representing all state associated with the underlying filesystem.
Enums§
- CmdError
- Command execution errors with contextual details.
- Index
State - Staged (index) status for a path.
- Worktree
State - Unstaged (worktree) status for a path.
Functions§
- add_
to_ index - Stage pathspecs into the index (like
git add), - get_
current_ commit_ hash - Retrieves the commit hash of the current HEAD.
- get_
status - Enumerate combined staged + unstaged status entries.
- restore
- Restore one or more paths from index or optional branch,
- unstage
- Unstage specific paths without touching working tree contents.