← All procedures

git.status

Get git status

CLI
Package
@procedures/git · README
Path
["git","status"]
CLI
mark git status
As data
{"$proc":["git","status"],"input":{}}

Use it

In TypeScript

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

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

From the command line

$ mark git status

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
cwdstringnoWorking directory (default: process.cwd())
shortbooleannofalseShow short format (default: false)

Output

FieldTypeRequiredDefaultDescription
branchstringyesThe current branch ("HEAD" when detached)
aheadnumberyesThe commits that the upstream does not have
behindnumberyesThe commits of the upstream that the branch does not have
filesobject[]yesThe changed, untracked and ignored files
cleanbooleanyesTrue when nothing changed
linesstring[]noWith short: true, one line per file as git status --short gives it
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "cwd": {
        "description": "Working directory (default: process.cwd())",
        "type": "string"
      },
      "short": {
        "default": false,
        "description": "Show short format (default: false)",
        "type": "boolean"
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "branch": {
        "type": "string",
        "description": "The current branch (\"HEAD\" when detached)"
      },
      "ahead": {
        "type": "number",
        "description": "The commits that the upstream does not have"
      },
      "behind": {
        "type": "number",
        "description": "The commits of the upstream that the branch does not have"
      },
      "files": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "The path of the file (for a rename or a copy, the new path)"
            },
            "from": {
              "description": "For a rename or a copy, the old path",
              "type": "string"
            },
            "status": {
              "type": "string",
              "enum": [
                "modified",
                "added",
                "deleted",
                "renamed",
                "copied",
                "untracked",
                "ignored"
              ],
              "description": "The change of the file"
            },
            "staged": {
              "type": "boolean",
              "description": "True when the change is in the index"
            }
          },
          "required": [
            "path",
            "status",
            "staged"
          ],
          "additionalProperties": {}
        },
        "description": "The changed, untracked and ignored files"
      },
      "clean": {
        "type": "boolean",
        "description": "True when nothing changed"
      },
      "lines": {
        "description": "With short: true, one line per file as git status --short gives it",
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "branch",
      "ahead",
      "behind",
      "files",
      "clean"
    ],
    "additionalProperties": {}
  }
}