Env Branch Switcher🇬🇧 English | 🇮🇩 Bahasa Indonesia A VS Code extension that automatically swaps your How it works
Storage layout inside your project:
Running it in your project1. Build & install the extension
Then reload VS Code ( 2. Enable it for your projectThe extension is disabled by default. Enable it per project by creating/editing
Or via the Command Palette: Or via the UI: By default every file named
3. Save
|
| Setting | Default | Description |
|---|---|---|
envBranchSwitcher.enabled |
false |
Automatically swap .env when switching branches |
envBranchSwitcher.envFile |
.env |
Env file name to find anywhere in the project, or a path relative to the repo root (e.g. backend/.env) |
envBranchSwitcher.exclude |
[".git", ".env-branches", "node_modules", "target", "build", "bin", "out", "dist", "vendor", ".gradle", ".idea", ".venv", "venv", "__pycache__"] |
Folder names skipped when searching for env files |
envBranchSwitcher.language |
auto |
Notification language: auto (follow VS Code), en, or id |
Commands
| Command | What it does |
|---|---|
Env Branch Switcher: Activation |
Choose true / false to set envBranchSwitcher.enabled in the workspace settings (default false) |
Env Branch Switcher: Language |
Choose English or Bahasa Indonesia for notifications (saved in your user settings, applies to all projects) |
Env Branch Switcher: Save .env for current branch |
Save the current .env as the active branch's snapshot (only while activated) |
Env Branch Switcher: Open snapshots folder |
Reveal .env-branches/ in the Explorer (only while activated) |
Env Branch Switcher: Reset (delete all saved snapshots) |
After a Yes/No confirmation, delete .env-branches/ (including backups) and start tracking again from the current branch. Your current .env files are not changed (only while activated) |
Notes
- While deactivated, branch switches are not tracked. After activating again, the current
.envis treated as belonging to the branch that was active when the extension was last enabled, so it is never saved under the wrong branch. - Before a snapshot is overwritten with different content, the old one is moved to
.env-branches/.backup/<branch>/<timestamp>/(the 5 most recent are kept). - Detached HEAD (e.g.
git checkout <commit>) is ignored. - If you switch branches while VS Code is closed, the swap happens when VS Code is reopened.
- Command titles and setting descriptions are shown in Indonesian only when the VS Code display language is Indonesian (requires a language pack). Notification language can be switched with Env Branch Switcher: Language (or
"envBranchSwitcher.language": "en"/"id"). - Snapshots live only on your local machine; deleting
.env-branches/deletes all saved.envfiles.
Development
See docs/DEVELOPMENT.md for running locally and publishing to Open VSX.