
GitLab Teams: Claude Code's --worktree Flag Now Accepts Merge Request URLs
Chris Harper
3 min read
Aug 15, 2026 · 12:05 UTC
Claude Code v2.1.233 adds GitLab MR URL support to --worktree — GitLab teams now get the same isolated code-review workflow GitHub PR users have had, plus memory and cache controls.
If you're on a GitLab team, --worktree just became more useful. The flag previously accepted GitHub PR URLs and spun up an isolated git worktree scoped to that PR's branch. v2.1.233 extends that to GitLab merge request URLs, so you can point Claude Code at any MR and work against it without touching your main checkout. MRs now also display as !N in the claude agents view alongside any GitHub PRs.
The workflow
Review or test a merge request without switching branches:
# Review an MR for correctness and security issues
claude --worktree https://gitlab.com/your-org/your-repo/-/merge_requests/417 \
"Review this MR for correctness issues and any security concerns. Check that error handling covers all paths."
# Run the test suite against the MR's changes
claude --worktree https://gitlab.com/your-org/your-repo/-/merge_requests/417 \
"Run pnpm test and report any new failures introduced by this MR's diff."
Claude checks out the MR's branch into a temporary worktree, scoped to those changes. Your working tree and branch are untouched. When the session ends, the worktree is cleaned up.
Watch active MRs in the agents view:
claude agents # MRs appear as !N alongside GitHub PRs
Two new environment controls also in v2.1.233
CLAUDE_CODE_TOOL_MEMORY_LIMIT (Linux, opt-in): caps memory for Bash tool commands via cgroup — useful on shared CI machines or self-hosted runners where a runaway build (pnpm install on a cold cache, gradle build, large Docker builds) can starve the session.
# Limit Bash tool commands to 4GB
export CLAUDE_CODE_TOOL_MEMORY_LIMIT=4g
claude ...
CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS: controls how long the WebFetch tool caches page fetches within a session. Default is 15 minutes (900000 ms). Reduce it if your agent needs fresh data on each loop iteration:
export CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS=60000 # 1-minute cache
Why this matters for GitLab shops
Claude Code's --worktree pattern is the foundation for AI-assisted code review in CI/CD pipelines. Teams on GitHub have been running Claude as a code-review step in Actions since the agent-as-reviewer pattern emerged earlier this year. GitLab shops can now set up the equivalent in GitLab CI:
# .gitlab-ci.yml
ai-review:
stage: review
script:
- claude --worktree $CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID
"Review this MR for correctness and performance issues. Post a markdown summary."
rules:
- if: $CI_MERGE_REQUEST_ID
Sources: Claude Code v2.1.233 release — GitHub · Claude Code changelog — code.claude.com · Claude Code worktree guide — claudefa.st