Expand description
Stage or discard selected Git changes interactively
Presents a compact TUI to multi‑select working tree entries and apply a bulk operation (stage or discard) with colorized progress output. Canceling any prompt safely results in no changes.
§Arguments
<branch>Optional branch used as blob source during restore in Discard; if omitted,git restorefalls back to index / HEAD.
§Usage
gch # select changes -> choose Add or Discard
gch main # use 'main' as blob source when discarding§Exit Codes
0Success (includes user cancellations performing no changes).- Non‑zero: bubbled I/O, subprocess, or git operation failure (reported via
color_eyre).
§Errors
- Status enumeration via [
ytil_git::get_status] fails. - User interaction (selection prompts via [
ytil_tui::minimal_multi_select] and [ytil_tui::minimal_select]) fails. - File / directory removal for new entries fails.
- Unstaging new index entries via [
ytil_git::unstage] fails. - Restore command construction / execution via [
ytil_git::restore] fails. - Opening repository via [
ytil_git::repo::discover] or adding paths to index via [ytil_git::add_to_index] fails.
§Rationale
- Delegates semantics to porcelain (
git restore,git add) to inherit nuanced Git behavior. - Minimal two‑prompt UX optimizes rapid iterative staging / discarding.
Structs§
- OpIter
- An iterator over the variants of Op
- Renderable
GitStatus Entry - Newtype wrapper adding colored
Displayfor a [ytil_git::GitStatusEntry].
Enums§
- Op
- High-level Git working tree/index operations exposed by the UI.
Functions§
- add_
entries 🔒 - Add the provided entries to the Git index (equivalent to
git addon each path). - main 🔒
- Stage or discard selected Git changes interactively.
- restore_
entries 🔒 - Delete newly created paths then restore modified paths (optionally from a branch)