← All procedures

git.diff

Show changes

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

From the command line

$ mark git diff

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
stagedbooleannofalseShow staged changes (default: false, shows unstaged)
refstringnoCompare against ref (branch/commit)
pathsstring[]noSpecific paths to diff
statbooleannofalseShow stat summary only (default: false)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
filesobject[]yesThe changed files
additionsnumberyesThe added lines of all files
deletionsnumberyesThe deleted lines of all files
diffstringnoThe text of the diff
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "staged": {
        "default": false,
        "description": "Show staged changes (default: false, shows unstaged)",
        "type": "boolean"
      },
      "ref": {
        "description": "Compare against ref (branch/commit)",
        "type": "string"
      },
      "paths": {
        "description": "Specific paths to diff",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "stat": {
        "default": false,
        "description": "Show stat summary only (default: false)",
        "type": "boolean"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "files": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "The path of the file (for a rename, the new path)"
            },
            "from": {
              "description": "For a rename, the old path",
              "type": "string"
            },
            "additions": {
              "type": "number",
              "description": "The added lines (0 for a binary file)"
            },
            "deletions": {
              "type": "number",
              "description": "The deleted lines (0 for a binary file)"
            }
          },
          "required": [
            "path",
            "additions",
            "deletions"
          ],
          "additionalProperties": {}
        },
        "description": "The changed files"
      },
      "additions": {
        "type": "number",
        "description": "The added lines of all files"
      },
      "deletions": {
        "type": "number",
        "description": "The deleted lines of all files"
      },
      "diff": {
        "description": "The text of the diff",
        "type": "string"
      }
    },
    "required": [
      "files",
      "additions",
      "deletions"
    ],
    "additionalProperties": {}
  }
}