Env Selector
Manage .env environment variants and Git branches from a modern sidebar interface — built for single projects and monorepos.

Features
- Automatic project detection — finds every folder in the workspace that contains a
.env file
- Environment variants — create, edit, and switch between named environments (e.g.
development, staging, production)
- One-click switching — selecting an environment writes its contents to the active
.env file
- Git branch control — view the current branch and check out another branch per project
- Monorepo presets — save and apply a joint profile that sets environment (and optionally branch) across all projects at once
- Theme-aware UI — follows your VS Code theme (light, dark, high contrast)
Requirements
- Visual Studio Code
1.85.0 or newer
- The built-in Git extension (
vscode.git) for branch management
Installation
From the Marketplace
Search for Env Selector in the VS Code Extensions view and click Install.
From a VSIX (manual)
npm install -g @vscode/vsce
npm run build
vsce package
code --install-extension env-selector-0.1.0.vsix
Getting started
- Open a workspace that contains at least one
.env file.
- Click the Env Selector icon in the Activity Bar (left sidebar).
- The extension scans the workspace and lists one card per detected project.
On first run, if a project already has a .env file but no variants yet, the extension imports it as a default variant inside .envs/default.env.
How environment storage works
Each project with a .env file gets a dedicated variants folder:
my-project/
.env ← active environment (written when you switch)
.envs/
default.env ← variant files
staging.env
production.env
| Path |
Purpose |
.env |
The file your app reads at runtime |
.envs/<name>.env |
Stored variant; switching copies its content into .env |
.envs/presets.json |
Workspace-level presets (monorepo only, at workspace root) |
The active environment name per project is stored in VS Code workspace state (not in your repo).
When switching environments, the extension backs up the current .env content inside .envs/ before overwriting.
Version control tips
- Add
.env to .gitignore if it contains secrets.
- Commit
.envs/*.env if your team shares environment templates (without secrets), or keep variants local.
- Commit
.envs/presets.json to share monorepo presets with your team.
Per-project controls
Each project card provides:
Active environment
- Dropdown — select a variant; the extension applies it immediately to
.env.
- Edit — open a key-value editor (or raw mode) for the selected variant.
- + New — create a new named variant.
- Delete — remove the selected variant (at least one variant must remain).
Git branch
- Dropdown — lists local branches and checks out the selected branch.
- If Git is unavailable or the folder is not inside a repository, a message is shown instead.
Use the Refresh button (↻) in the header to rescan projects after adding or removing .env files.
Presets (monorepo)
When multiple projects are detected, a Presets section appears at the top of the sidebar.
Presets let you switch every project to a known configuration with one click — useful for moving between development, staging, and production setups across a monorepo.
Preset file location
workspace-root/
.envs/
presets.json
Example:
{
"version": 1,
"presets": [
{
"id": "preset-1234567890-abc123",
"name": "staging",
"entries": [
{ "projectId": "api", "envName": "staging", "branch": "develop" },
{ "projectId": "web", "envName": "staging" }
]
}
]
}
Each entry maps a project ID (relative workspace path) to:
envName (required) — variant to apply
branch (optional) — branch to check out; omitted entries skip branch changes
Preset actions
| Action |
Description |
| Apply |
Applies the selected preset to all matching projects |
| Save current |
Creates a preset from the current active environment and branch of each project |
| + New preset |
Opens the preset editor to define mappings manually |
| Edit |
Modify the selected preset |
| Delete |
Remove the selected preset |
Partial failures
When applying a preset:
- Projects with missing environments or unknown project IDs are skipped with a warning.
- If one project fails (e.g. dirty Git working tree), other projects still apply.
- A summary toast reports successes, failures, and skipped entries.
Commands
| Command |
Description |
Env Selector: Refresh projects |
Rescan the workspace for .env files |