Skip to main content

shift-cli git

Git — platform-managed Git operations.

Usage

shift-cli git <subcommand> [arguments] [flags]

Description

The Git CLI provides access to the platform's experimental Git service. It enables provider management, repository connections, and read operations through the gateway at /api/v1/git/*.

For day-to-day app scaffolding, the recommended path is shift-cli create-app plus gh on the local machine, with repository linkage stored on the Stage app.

Subcommands

Provider Management

# List registered Git providers
shift-cli git providers list [--json]

# Add a Git provider
shift-cli git providers add --name github-org --type github --token $GITHUB_TOKEN [--json]

# Remove a provider
shift-cli git providers rm <id-or-name> [--json]

Repository Operations

# List connected repositories
shift-cli git repos list [--provider <id>] [--json]

# Connect a repository
shift-cli git repos connect --provider github-org --owner the-shift-dev --name platform [--json]

# Get repository details
shift-cli git repos get <id-or-name> [--json]

# Disconnect a repository
shift-cli git repos rm <id-or-name> [--json]

Branch Operations

# List branches for a repository
shift-cli git branches list --repo <id-or-name> [--json]

# Get branch details
shift-cli git branches get --repo <id-or-name> <branch-name> [--json]

Commits

# List recent commits
shift-cli git commits list --repo <id-or-name> [--branch main] [--limit 10] [--json]

File Operations

# Read a file from a branch
shift-cli git files read --repo <id-or-name> --branch main <file-path> [--json]

Examples

# Register GitHub and list repos
shift-cli git providers add --name github --type github --token $GITHUB_TOKEN --json
shift-cli git repos list --provider github --json

# Check branches on a connected repo
shift-cli git branches list --repo platform --json

# Read package.json from main
shift-cli git files read --repo platform --branch main package.json --json