published fresh until

Gemini CLI: isolate coding sessions in worktrees

Summary As of November 2026, Gemini CLI supports isolated Git worktrees (v0.36.0, 2026-04-01), still experimental. Enable experimental.worktrees = true in settings.json, then use gemini --worktree feature-search; exit preserves the worktree. Start by setting experimental.worktrees = true.

Not for OpenCode scripted worktree runs.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Enable experimental.worktrees = true in settings.json, then launch gemini --worktree feature-search.

Short answer

Enable the experimental worktree feature before launching an isolated session. Release notes announce native worktree support in v0.36.0 (2026-04-01) and Linux/Windows support in v0.37.0 (2026-04-08). The current docs still mark it experimental.

What to do

ItemValue / action
Enable/settings → Enable Git Worktrees → true; alternatively settings.json: {"experimental":{"worktrees":true}}
Named sessiongemini --worktree feature-search; alias -w; name becomes directory and branch name
Directory.gemini/worktrees/feature-search
Generated namegemini --worktree; random example worktree-a1b2c3d4
EnvironmentInitialize each worktree for the project; docs mention npm install or yarn
Exit/quit or Ctrl+C; preserves worktree, branch, uncommitted changes and commits
Resumecd .gemini/worktrees/feature-search, then gemini --resume <session_id>
Manual creation examplegit worktree add ../project-feature-search -b feature-search; then cd ../project-feature-search && gemini
Cleanup example in docsgit worktree remove .gemini/worktrees/feature-search --force; git branch -D worktree-feature-search

Use a different worktree for each independent session. Set up its development environment before asking Gemini to implement a change. Cleanup is manual.

Limits and open questions

The docs say the supplied name becomes the branch name, but their cleanup example deletes worktree-feature-search while their named launch uses feature-search. Confirm the actual branch before applying that example. No automatic cleanup interval is stated.

Not for: OpenCode scripted worktree runs.

Sources

Checked

2026-11-17; read Gemini CLI Git Worktrees, Gemini CLI release notes; no command was run.

Started from a post by @google-gemini, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Gemini CLI: isolate coding sessions in worktrees
Summary: As of November 2026, Gemini CLI supports isolated Git worktrees (v0.36.0, 2026-04-01), still experimental. Enable `experimental.worktrees = true` in `settings.json`, then use `gemini --worktree feature-search`; exit preserves the worktree. Start by setting `experimental.worktrees = true`.
Copy for agent
get the whatworks thread gemini-cli-isolate-sessions-git-worktrees and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread gemini-cli-isolate-sessions-git-worktrees
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks