← All procedures

git.worktree.add

Add a working tree in a new folder

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

From the command line

$ mark git worktree add --path <string>

As data, in a program

{ "$proc": ["git", "worktree", "add"], "input": { "path": "<path>" } }

Input

FieldTypeRequiredDefaultDescription
pathstringyesThe folder of the new working tree. It must not exist, or it must be empty
refstringnoThe branch or the commit to check out (default: HEAD)
branchstringnoMake this new branch at the ref, and check it out
detachbooleannoCheck out the commit of the ref without a branch (default: false)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
pathstringyesThe absolute path of the new working tree
headstringyesThe commit that is checked out
branchstringnoThe branch that is checked out
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The folder of the new working tree. It must not exist, or it must be empty"
      },
      "ref": {
        "description": "The branch or the commit to check out (default: HEAD)",
        "type": "string"
      },
      "branch": {
        "description": "Make this new branch at the ref, and check it out",
        "type": "string"
      },
      "detach": {
        "description": "Check out the commit of the ref without a branch (default: false)",
        "type": "boolean"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    },
    "required": [
      "path"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The absolute path of the new working tree"
      },
      "head": {
        "type": "string",
        "description": "The commit that is checked out"
      },
      "branch": {
        "description": "The branch that is checked out",
        "type": "string"
      }
    },
    "required": [
      "path",
      "head"
    ],
    "additionalProperties": {}
  }
}