sincecutoff.com
← all changes

neonctl checkout pins a branch in .neon

Introduced 2026-06-04 · score 0.95

HOW TO USE IT

When switching a repository’s Neon context to a branch, run `neonctl checkout <id|name>`; it resolves the branch for the active project and updates `.neon` so subsequent commands use it. In CI or without a TTY, pass the branch explicitly.

neonctl checkout <id|name>
neonctl checkout <branch> --project-id <project_id>

WHY THIS HELPS

Switch a repository’s Neon CLI context to the branch being worked on.

BEFORE THIS CHANGE

Use `neonctl set-context` to write `.neon` context directly; checkout is documented as a focused helper over `set-context` for switching branches.

REQUIREMENTS AND LIMITATIONS

  • Version: v2.22.2
  • [id|name]: Branch ID or name. Omit only in an interactive terminal to choose from a branch list; `br-…` is treated as an ID. A missing name may be offered for creation interactively.
  • --project-id <id>: Select the project; takes precedence over the closest `.neon` project ID and single-project API-key auto-detection.
  • --org-id <id>: Organization ID; used to identify the organization when supplied. Otherwise checkout can use the existing `.neon` value or look it up from the project.
  • --api-key <neon_api_key>: Authenticates the command with a Neon API key instead of `neonctl auth`.
  • Prerequisite: Install the Neon CLI; the README documents `npm i -g neonctl` and requires Node.js 18.0 or higher for npm installation.
  • Prerequisite: Authenticate with `neonctl auth` or pass `--api-key`.
  • Prerequisite: In CI or without a TTY, pass the branch explicitly.
  • An omitted branch is supported only in an interactive terminal; in CI or without a TTY, pass a branch explicitly.
  • A `br-…` value is treated as an id and matched strictly; a nonexistent id produces a not-found error and is not created.
  • A missing name can be created only through the interactive-terminal offer; in a non-interactive context a missing name produces a not-found error.
  • Project resolution order is `--project-id`, the closest `.neon`, then auto-detection when the API key maps to exactly one project.
  • When a project has an organization, checkout writes `orgId` as well as `projectId` and `branchId`; when `orgId` is unknown it is looked up from the project.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card