← All procedures

git.checkout

Checkout branch or files

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

From the command line

$ mark git checkout --ref <string>

As data, in a program

{ "$proc": ["git", "checkout"], "input": { "ref": "<ref>" } }

Input

FieldTypeRequiredDefaultDescription
refstringyesBranch, tag, or commit to checkout
createbooleannofalseCreate branch if it doesn't exist (default: false)
pathsstring[]noSpecific paths to checkout (default: all)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
refstringyesThe branch or the ref that is checked out
createdbooleanyesTrue when the call made the branch
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ref": {
        "type": "string",
        "description": "Branch, tag, or commit to checkout"
      },
      "create": {
        "default": false,
        "description": "Create branch if it doesn't exist (default: false)",
        "type": "boolean"
      },
      "paths": {
        "description": "Specific paths to checkout (default: all)",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    },
    "required": [
      "ref"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "ref": {
        "type": "string",
        "description": "The branch or the ref that is checked out"
      },
      "created": {
        "type": "boolean",
        "description": "True when the call made the branch"
      }
    },
    "required": [
      "ref",
      "created"
    ],
    "additionalProperties": {}
  }
}