← All procedures

git.restore

Restore files of the working tree or the index. The changes of the files are lost

CLI
Package
@procedures/git · README
Path
["git","restore"]
CLI
mark git restore --paths <string[]>
As data
{"$proc":["git","restore"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/git/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["git","restore"], { paths: [] });
console.log(JSON.stringify(result));

From the command line

$ mark git restore --paths <string[]>

As data, in a program

{ "$proc": ["git", "restore"], "input": { "paths": [] } }

Input

FieldTypeRequiredDefaultDescription
pathsstring[]yesThe paths to restore
sourcestringnoThe commit to restore from (default: the index for the working tree, HEAD for the index)
stagedbooleannoRestore the index: this unstages the changes (default: false)
worktreebooleannoRestore the working tree (default: true without staged, false with staged)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
restoredstring[]yesThe paths of the input
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "paths": {
        "minItems": 1,
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The paths to restore"
      },
      "source": {
        "description": "The commit to restore from (default: the index for the working tree, HEAD for the index)",
        "type": "string"
      },
      "staged": {
        "description": "Restore the index: this unstages the changes (default: false)",
        "type": "boolean"
      },
      "worktree": {
        "description": "Restore the working tree (default: true without staged, false with staged)",
        "type": "boolean"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    },
    "required": [
      "paths"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "restored": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The paths of the input"
      }
    },
    "required": [
      "restored"
    ],
    "additionalProperties": {}
  }
}