﻿---
title: "CLI 0.154 可用 --worktree 开隔离会话"
summary: "实验性能力：新开会话或 fork 时用 --worktree / /worktree 建隔离 checkout，之后还能浏览和 resume。"
category: session
level: intermediate
surfaces: [cli]
tags: ["worktree", "并行", "0.154"]
canonical: /tips/cli-managed-worktree/
---

# CLI 0.154 可用 --worktree 开隔离会话

实验性能力：新开会话或 fork 时用 --worktree / /worktree 建隔离 checkout，之后还能浏览和 resume。

以前 CLI 要自己 `git worktree add`。官方 changelog 0.154.0 起，实验性托管 worktree 可以直接开：

```bash
codex --worktree feature/isolated
```

TUI 里用 `/worktree` 创建、切换、定位和清理。也可以浏览已有树并 resume。`codex exec` 同样能挂上托管 worktree。

注意：

- 这是实验功能。本机没有这些命令时，先 `/experimental` 或 `codex features list`，再对照 `/help`
- 脏工作区会问你是把未提交改动带走，还是留在原 checkout
- 合完仍要清理，孤立树会复制 `node_modules` 和磁盘

桌面 App 的 worktree 还是那套 Handoff / 自动清理。CLI 这条是给终端并行任务用的。动手前以当前 changelog 为准。

## 来源

- [OpenAI · Codex changelog 0.154.0](https://developers.openai.com/codex/changelog)
- [X · Codex Changelog](https://x.com/Codex_Changelog/status/2097825113588498834)
