← All procedures

git.reset

Move HEAD to a commit, and reset the index (mixed) or also the working tree (hard)

CLI
Package
@procedures/git · README
Path
["git","reset"]
CLI
mark git reset
As data
{"$proc":["git","reset"],"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","reset"], {});
console.log(JSON.stringify(result));

From the command line

$ mark git reset

As data, in a program

{ "$proc": ["git", "reset"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
refstringnoThe commit (default: HEAD)
mode"soft" | "mixed" | "hard" | "merge" | "keep"nosoft keeps the index, mixed resets the index, hard also resets the working tree (default: mixed)
pathsstring[]noReset only these paths in the index. HEAD does not move. Only the mode mixed accepts paths
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
refstringyesThe commit of the reset
mode"soft" | "mixed" | "hard" | "merge" | "keep"yesThe mode of the reset
hashstringyesHEAD after the reset
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ref": {
        "description": "The commit (default: HEAD)",
        "type": "string"
      },
      "mode": {
        "description": "soft keeps the index, mixed resets the index, hard also resets the working tree (default: mixed)",
        "type": "string",
        "enum": [
          "soft",
          "mixed",
          "hard",
          "merge",
          "keep"
        ]
      },
      "paths": {
        "description": "Reset only these paths in the index. HEAD does not move. Only the mode mixed accepts paths",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "ref": {
        "type": "string",
        "description": "The commit of the reset"
      },
      "mode": {
        "type": "string",
        "enum": [
          "soft",
          "mixed",
          "hard",
          "merge",
          "keep"
        ],
        "description": "The mode of the reset"
      },
      "hash": {
        "type": "string",
        "description": "HEAD after the reset"
      }
    },
    "required": [
      "ref",
      "mode",
      "hash"
    ],
    "additionalProperties": {}
  }
}