ek9_git_restore

Reports mode, paths and pathCount and a summary line; ref restores content from that commit instead of the index or HEAD.

Category: Execution · Compare: git restore / Revert / Unstage

When to use it

'Unstage this' or 'throw away my edits' - one call with paths:[...]; mode:'unstage' (default, safe) or mode:'discard' (destructive). Pass ref to restore the content from that commit instead.

When not to use it

Details

mode:'unstage' takes the paths out of the index and leaves the working tree alone; mode:'discard' overwrites the working tree from the index (or from ref); mode:'both' does both from HEAD. discard is a one-way door for edits made outside the workspace tools. The IDE aliases staged:true / worktree:true map to unstage / discard; sending them alongside a contradicting mode is refused. An untracked path is refused as path-not-tracked with the route.

Arguments

ArgumentTypeRequiredWhat it is
modestring: unstage | discard | bothDefault unstage (take out of the index, keep the working-tree edits); discard (overwrite the working-tree edits - DESTRUCTIVE); both.
pathsarray of stringyesWorkspace-relative paths to restore.
refstringCommit to restore content from. Default: the index for discard, HEAD for unstage.
stagedbooleanIDE alias: true means mode:'unstage'.
worktreebooleanIDE alias: true means mode:'discard' (with staged:true, mode:'both').