restore

Function restore 

Source
pub fn restore<I, P>(paths: I, branch: Option<&str>) -> Result<()>
where I: IntoIterator<Item = P>, P: AsRef<str>,
Expand description

Restore one or more paths from index or optional branch,

Delegates to porcelain git restore rather than approximating behavior with libgit2. If branch is provided its tree is the source; otherwise the index / HEAD is used.

§Errors

  • Spawning or executing the git restore process fails.

§Rationale

Porcelain subcommand encapsulates nuanced restore semantics (rename detection, pathspec interpretation) that would be complex and error‑prone to replicate directly.

§Future Work

  • Support partial restore when command fails mid‑batch by iterating per path.
  • Add dry‑run flag to preview intended operations.