Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Neon · Command

neonctl set-context

Saves Neon project, organization, and optionally branch context for later CLI commands. Use a default .neon file or select a named context file with --context-file.

How it works

The command stores project, organization, and optionally branch context in a default .neon file or a file selected with --context-file. Later CLI commands can use that context instead of repeating identifiers; running the command without options clears the current context.

Syntax

neon set-context [options]

Parameters

NameTypeDescription
--branch-idstringBranch ID to save in the context.
--org-idstringOrganization ID to save in the context.
--project-idstringProject ID to save in the context.
--context-filestringPath to a context file other than the default .neon file.

Returns

Creates or updates a context file; with no options, clears the current context.

Key points

  • set-context establishes reusable CLI context so project-specific commands can omit repeated identifiers.
  • Without a custom file, Neon stores the context in .neon.
  • Use the global --context-file option to choose a different context-file path.
  • Separate named files let you switch between organization and project contexts.
  • The command accepts an optional branch identifier alongside project and organization identifiers.

Common mistakes

  • At least one of --branch-id, --org-id, or --project-id must be supplied when setting a context.
  • Running set-context without options clears the current context; deleting the relevant context file also removes it.

Example: Save a named Neon context

neon set-context --project-id patient-frost-50125040 --org-id org-bright-sky-12345678 --context-file .neon-dev

Saves project and organization identifiers in a named context file for subsequent CLI commands.

When to use it

Avoid repeating project and organization flags

Local development

Switch between named context files

Multiple projects

Clear the active CLI context

Cleanup

Interview questions

QWhat problem does set-context solve?

It saves CLI context, such as a project or organization identifier, to a .neon file so later commands do not need those flags repeatedly. The default file is in the current directory unless --context-file selects another file.

Follow-up: How would you maintain separate contexts? Use different named files with --context-file, then pass the desired file to subsequent commands.

QWhat is the command syntax and required input?

Use neon set-context --project-id <project-id> --org-id <org-id>. At least one of the project, organization, or branch options must be provided.

Follow-up: How can a branch be included? Add --branch-id <branch-id> to the command.

QHow do you clear a saved context?

Run neon set-context with no options to clear the current context, or delete the default .neon file or the selected custom context file. This removes the stored context used by later commands.

Follow-up: How can a later command select a named context? Add --context-file <file> to that command.

  • neon branches list
  • neon projects list
  • --context-file

Source: Neon CLI command: set-context - Neon Docs. Checked 2026-10-16.