Crate ytil_git

Crate ytil_git 

Source
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§

branch
Branch operations for Git repositories.
diff
remote
repo

Structs§

GitStatusEntry
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.
IndexState
Staged (index) status for a path.
WorktreeState
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.