ek9_git_restore
Reports mode, paths and pathCount and a summary line; ref restores content from that commit instead of the index or HEAD.
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
- undoing a commit that is already made - use
ek9_git_revert. - staging changes - use
ek9_git_add(this tool is its inverse). - moving between branches - use
ek9_git_switch. - seeing what is staged or modified first - use
ek9_git_status.
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
| Argument | Type | Required | What it is |
|---|---|---|---|
mode | string: unstage | discard | both | Default unstage (take out of the index, keep the working-tree edits); discard (overwrite the working-tree edits - DESTRUCTIVE); both. | |
paths | array of string | yes | Workspace-relative paths to restore. |
ref | string | Commit to restore content from. Default: the index for discard, HEAD for unstage. | |
staged | boolean | IDE alias: true means mode:'unstage'. | |
worktree | boolean | IDE alias: true means mode:'discard' (with staged:true, mode:'both'). |