Claude.app: "in-folder" session start fails on macOS — git checkout --end-of-options not supported by Apple's bundled git 2.39.5
Summary
When starting a new session in Claude.app on macOS and selecting a source branch without enabling "use worktree", the session start fails immediately with:
Failed to switch to "<branch>" in <path>: /usr/bin/git exited with code 1: error: pathspec '--end-of-options' did not match any file(s) known to git error: pathspec '<branch>' did not match any file(s) known to git
The branch exists, the working tree is clean, and the same branch switches successfully via git switch <branch> on the same /usr/bin/git.
Root cause
The desktop app invokes git checkout --end-of-options <branch> via the hardcoded /usr/bin/git. Apple's bundled git (2.39.5, Apple Git-154) accepts --end-of-options on git switch but not on git checkout — it falls through and treats both --end-of-options and the branch name as pathspecs.
In the bundled main process (/Applications/Claude.app/Contents/Resources/app.asar, .vite/build/index.js):
await yr(["checkout", "--end-of-options", i.sourceBranch], i.cwd, 3e4)
// ...
throw new Error(`Failed to switch to "${i.sourceBranch}" in ${i.cwd}: ${h}`)
/usr/bin/git is hardcoded earlier in the same bundle.
Reproduction
- macOS with stock Apple git (
/usr/bin/git --version→git version 2.39.5 (Apple Git-154)). - In Claude.app, start a new session in a repo where the current branch is not the branch you want.
- Specify a
sourceBranch(e.g.dev). - Leave "use worktree" disabled.
- Working tree is clean, target branch exists locally.
Result: session start fails with the error above.
Confirmation from terminal:
/usr/bin/git checkout --end-of-options dev→ fails identically/usr/bin/git switch --end-of-options dev→ succeeds/usr/bin/git checkout dev(no flag) → succeeds
Installing a newer git via Homebrew doesn't help, because the app uses the hardcoded /usr/bin/git, which on macOS is the Apple binary tied to Xcode/CLT and can't be replaced (SIP).
Suggested fix
Either:
- Replace
["checkout", "--end-of-options", branch]with["switch", "--end-of-options", branch]— semantically what's intended, and--end-of-optionsis honoured byswitchon Apple's git. - Drop
--end-of-optionsfor thecheckoutform (then re-validate the branch name some other way to keep the safety guarantee). - Resolve
gitvia PATH instead of hardcoding/usr/bin/git, so users on a newer git aren't stuck with this.
Option 1 looks cleanest.
Environment
- Claude.app version: 1.8555.2
- macOS: Darwin 23.6.0
- Architecture: arm64 (Apple Silicon)
/usr/bin/git --version: 2.39.5 (Apple Git-154)xcode-select -p:/Applications/Xcode.app/Contents/Developer
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗