← All procedures

git.branch.list

List the branches, and give the current branch

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

From the command line

$ mark git branch list

As data, in a program

{ "$proc": ["git", "branch", "list"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
remotebooleannoAlso list the remote-tracking branches (default: false)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
branchesobject[]yesThe branches
currentstringyesThe current branch ("HEAD" when detached)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "remote": {
        "description": "Also list the remote-tracking branches (default: false)",
        "type": "boolean"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "branches": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The branch name"
            },
            "current": {
              "type": "boolean",
              "description": "True for the current branch"
            },
            "remote": {
              "type": "boolean",
              "description": "True for a remote-tracking branch"
            },
            "tracking": {
              "description": "The upstream of the branch",
              "type": "string"
            }
          },
          "required": [
            "name",
            "current",
            "remote"
          ],
          "additionalProperties": {}
        },
        "description": "The branches"
      },
      "current": {
        "type": "string",
        "description": "The current branch (\"HEAD\" when detached)"
      }
    },
    "required": [
      "branches",
      "current"
    ],
    "additionalProperties": {}
  }
}