[BUG] `/ultrareview` fails in bare-repo + worktree container directory

Resolved 💬 3 comments Opened Apr 18, 2026 by CybotTM Closed May 25, 2026

What's wrong

/ultrareview (no args) fails with:

Could not find merge-base with master. Make sure you're in a git repo with a master branch.

…when Claude Code is launched from the parent directory of a bare-repo + worktree layout — a common pattern:

~/projects/myrepo/              ← CWD when claude is launched
├── .bare/                      ← bare git repo (clone --bare)
├── master/                     ← worktree
└── feature-branch/             ← worktree

The parent dir is not itself a git repo (no .git file or dir), so /ultrareview's merge-base lookup can't resolve anything, even though multiple valid worktrees live as direct subdirectories.

Expected behavior

One of:

  1. Auto-descend into a worktree. When CWD is a directory containing .bare/ (or a matching gitdir pointer) and one or more worktree subdirectories, pick the one matching the current branch/HEAD (or prompt the user).
  2. Better error message. Instead of "Could not find merge-base with master," say something like:

> /ultrareview needs to run inside a git working tree. Current directory appears to be a bare-repo container — try cd into one of the worktree subdirectories (e.g. ./master/).

The current error is misleading because it implies the repo is missing a master branch, when the real problem is CWD is not a git working tree at all.

Steps to reproduce

mkdir /tmp/repro && cd /tmp/repro
git clone --bare https://github.com/anthropics/claude-code.git .bare
git -C .bare worktree add ../main main
# now CWD /tmp/repro has .bare/ + main/ but is not itself a git repo
claude
# inside Claude Code:
/ultrareview
# → "Could not find merge-base with master. Make sure you're in a git repo with a master branch."

Workaround: cd main && /ultrareview works fine.

Why this matters

The bare-repo + worktree layout is increasingly common for parallel feature work (recommended by many internal dev guides and mandated by some team conventions). Several existing Claude Code issues already flag related bare-repo gaps:

  • #27439 — claude --worktree fails inside a bare repository
  • #44709 — Subagents default to bare repo root instead of current worktree
  • #48110 — --resume shows no sessions when CWD is a bare-repo root
  • #42927 — FR: bare-repo .claude config support

This report is specifically about /ultrareview behavior — not covered by those.

Environment

  • Claude Code: 2.1.114
  • git: 2.53.0
  • OS: Linux 6.6.87.2 (WSL2 on Windows)
  • Shell: bash
  • Model: claude-opus-4-7 (1M context)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗