> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instapods.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Git

> Connect a Git repository and manage deployments from the CLI.

The `git` commands let you connect a repository, trigger deploys, view build logs, and roll back — all without leaving the terminal.

## Connect a Repository

```bash theme={null}
instapods git connect NAME --repo URL [flags]
```

| Flag           | Description                      | Default       |
| -------------- | -------------------------------- | ------------- |
| `--repo`       | Repository URL (required)        | —             |
| `--branch`     | Branch to deploy from            | `main`        |
| `--auth-token` | Auth token for private repos     | None          |
| `--build-cmd`  | Custom build command             | Auto-detected |
| `--deploy`     | Trigger first deploy immediately | `false`       |

**Examples:**

```bash theme={null}
# Public GitHub repo
instapods git connect my-app --repo https://github.com/you/repo --deploy

# Private repo with token, custom branch
instapods git connect my-app \
  --repo https://github.com/you/private-repo \
  --auth-token ghp_abc123 \
  --branch develop

# Custom build command
instapods git connect my-app \
  --repo https://github.com/you/repo \
  --build-cmd "npm ci && npm run build" \
  --deploy
```

## Disconnect

```bash theme={null}
instapods git disconnect NAME [-f]
```

| Flag | Description              |
| ---- | ------------------------ |
| `-f` | Skip confirmation prompt |

Removes the git connection and webhook. Deployed code stays in the pod.

## Status

```bash theme={null}
instapods git status NAME
```

Shows the connected repository, branch, auto-deploy setting, and latest deployment status.

## Trigger a Deploy

```bash theme={null}
instapods git deploy NAME [-w] [--timeout DURATION]
```

| Flag         | Description               | Default |
| ------------ | ------------------------- | ------- |
| `-w, --wait` | Wait for deploy to finish | `false` |
| `--timeout`  | Max wait duration         | `300s`  |

```bash theme={null}
# Fire and forget
instapods git deploy my-app

# Wait for completion
instapods git deploy my-app -w

# Wait with custom timeout
instapods git deploy my-app -w --timeout 600s
```

## Deployment History

```bash theme={null}
instapods git deployments NAME [-n COUNT]
```

| Flag | Description                   | Default |
| ---- | ----------------------------- | ------- |
| `-n` | Number of deployments to show | `10`    |

```bash theme={null}
instapods git deployments my-app
instapods git deployments my-app -n 25
```

## Build Logs

```bash theme={null}
instapods git logs NAME [DEPLOY_ID]
```

Without a deployment ID, shows logs from the most recent deployment.

```bash theme={null}
# Latest deployment logs
instapods git logs my-app

# Specific deployment
instapods git logs my-app deploy_abc123
```

## Rollback

```bash theme={null}
instapods git rollback NAME [DEPLOY_ID] [-f] [-w]
```

| Flag         | Description                 |
| ------------ | --------------------------- |
| `-f`         | Skip confirmation prompt    |
| `-w, --wait` | Wait for rollback to finish |

Without a deployment ID, rolls back to the previous deployment.

```bash theme={null}
# Rollback to previous
instapods git rollback my-app

# Rollback to specific deployment, no prompt, wait
instapods git rollback my-app deploy_abc123 -f -w
```
