CLAUDE_CODE_BASE_REFS

Updated by

CLAUDE_CODE_BASE_REFS is a Claude Code environment variable: Specifies base git references (branches, tags, or SHAs) for diff comparison when Claude Code operates in a worktree or feature branch. In multi-worktree agent workflows — where several subagents run in parallel on isolated worktrees — each agent needs to know what "main" means for its context. Its release history is not tracked here. It is not in the official reference.

StatusPresent in v2.1.294
CategoryOther
Official docsNot listed

How to set it

For one session, export it in the shell that starts Claude Code:

export CLAUDE_CODE_BASE_REFS=<value>
claude

To apply it to every session, add it to the env object of a settings file:

// ~/.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_BASE_REFS": "<value>"
  }
}

Release notes that mention it

Related variables

Frequently asked questions

What does CLAUDE_CODE_BASE_REFS do?

Specifies base git references (branches, tags, or SHAs) for diff comparison when Claude Code operates in a worktree or feature branch. In multi-worktree agent workflows — where several subagents run in parallel on isolated worktrees — each agent needs to know what "main" means for its context.

Which Claude Code version has CLAUDE_CODE_BASE_REFS?

Its release history is not tracked here.

How do I set CLAUDE_CODE_BASE_REFS?

Export it before starting Claude Code (export CLAUDE_CODE_BASE_REFS=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.

All variables, searchable: Claude Code environment variables.