# codex worktree 如何使用

**URL:** <https://forum.beginner.center/t/topic/2948>\
**Category:** 🛠工具与编程\
**Tags:** git, codex\
**Created:** [2026 年7 月 23 日 02:53 UTC](https://forum.beginner.center/t/topic/2948 "2026-07-23T02:53:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![doggie](https://forum.beginner.center/user_avatar/forum.beginner.center/doggie/32/550_2.png) [@doggie](https://forum.beginner.center/u/doggie)\
发布日期： [2026 年7 月 23 日 02:53 UTC](https://forum.beginner.center/t/topic/2948/1 "2026-07-23T02:53:28Z")

</div>

# 首先进入主工作树（worktree）

```auto
cd /Users/ww/coding/main_worktree  

```

# 合并由 codex 创建的工作树（worktree）

```auto
git merge --ff-only codex/new-branch  

```

验证合并结果

```auto
git log --oneline --decorate -3  

```

若无问题，则推送

```auto
git push  

```

# 删除已用完的工作树（worktree）

```auto
git worktree remove codex-worktree  
git branch -d codex/new-branch  

```

# 参考

- [Codex Worktrees 使用指南：如何让 Codex 并行工作而不打乱你的本地开发环境](https://forum.beginner.center/t/topic/2947)
