Skip to main content

checkout_discard

Function checkout_discard 

Source
pub fn checkout_discard(region: &[OsString]) -> Result<Discard, OptionError>
Expand description

What: Read a git checkout region. Result<A, B> is “either success A or failure B”. Why: --force, --patch, --ours, --theirs, a path list (--, --pathspec-from-file, or a tree-ish followed by paths) overwrite files; a lone name moves HEAD or, when it is a file, overwrites it, so it counts as a HEAD move that is rejected once local changes exist.

In TS you’d write (pseudocode):

function checkoutDiscard(region: string[]): Discard; // throws OptionError