cmux로 AI 코딩 병렬 작업하기: Git worktree로 작업 공간 나누기
앞선 cmux 소개 글에서는 워크스페이스와 화면 분할, 알림을 살펴봤습니다. 이번에는 cmux에서 두 AI 코딩 작업을 나란히 관리하면서 Git worktree로 실제 작업 폴더를 분리하는 방법을 정리합니다.[1][4]
화면을 나누는 것과 파일을 나누는 것은 다릅니다. cmux의 pane 두 개가 같은 폴더를 가리키면 두 에이전트는 같은 파일을 수정합니다. 반대로 worktree는 브랜치별 작업 파일을 분리하지만, 나중에 변경을 합칠 때의 충돌까지 없애지는 않습니다.[2][4]
이 글의 Git 명령은 2026년 11월 25일, macOS의 Git 2.54.0과 별도 시험 저장소에서 실행했습니다. 두 폴더의 변경 분리와 중복 브랜치 오류를 확인했습니다. cmux의 GUI, 에이전트 실행과 알림은 직접 재현하지 않았으며 공식 문서 기준입니다.
먼저 나눌 것: 화면과 파일
cmux의 워크스페이스는 사이드바에서 전환하는 작업 단위이고 pane은 그 안의 분할 영역입니다.[2] Git worktree는 하나의 저장소에 연결된 별도의 작업 폴더를 만듭니다. 각 폴더는 서로 다른 브랜치를 체크아웃할 수 있지만 Git 저장소와 일부 설정은 공유합니다.[4]

cmux 공식 홈페이지의 제품 화면. 여러 작업을 사이드바와 분할 영역에서 전환하는 모습을 보여 줍니다. (출처: cmux, 2026-11-24 확인)
이 예제에서는 demo-repo를 기준 저장소로, demo-ui와 demo-tests를 각각 UI와 테스트 작업용 폴더로 사용합니다. 두 작업의 담당 파일을 미리 정하고, 공통 설정이나 잠금 파일을 동시에 바꾸지 않도록 하는 편이 좋습니다.
1. 기준 커밋과 작업 범위 확인하기
실제 작업에 적용하기 전에 원본 저장소에서 현재 브랜치와 변경 파일을 확인하세요.
git status --short --branch
git status는 브랜치와 변경·추적되지 않은 파일을 확인하는 데 사용합니다.[7] 아래 예제의 기준은 현재 체크아웃한 마지막 커밋인 HEAD입니다. 커밋하지 않은 변경이나 Git이 무시하는 파일이 새 worktree에 자동으로 복사되는 것은 아닙니다. 필요한 작업이 원본 폴더에 남아 있다면 먼저 살펴보고, 중요한 파일은 안전하게 보존하세요.[4][7]
예제 경로와 브랜치 이름은 새 항목을 만드는 이름입니다. 기존에 같은 폴더나 브랜치가 있다면 다른 이름을 정하세요. 예제는 원본 저장소 폴더에서 실행합니다.
2. 작업별 worktree 만들기
두 명령은 현재 HEAD를 기준으로 서로 다른 브랜치와 이웃 폴더를 만듭니다.[4]
git worktree add -b task/ui ../demo-ui HEAD
git worktree add -b task/tests ../demo-tests HEAD
git worktree list
목록에서 원본 폴더, demo-ui의 task/ui, demo-tests의 task/tests를 확인하세요. 실제 경로와 커밋 ID는 환경마다 다릅니다. 시험 저장소에서 demo-ui의 파일을 바꾼 뒤에도 demo-tests의 같은 파일은 바뀌지 않는 것을 확인했습니다.
같은 브랜치 이름으로 다시 생성하면 Git이 거부할 수 있습니다. 예제에서도 task/ui가 이미 있을 때 같은 -b 명령이 실패했습니다. 기존 worktree와 브랜치를 확인하고 새 이름을 사용하세요. 충돌을 피하려고 강제 옵션을 먼저 쓰지는 마세요.[4]
3. cmux에 각 폴더 연결하기
cmux에서 새 워크스페이스를 열고, 각 터미널이 서로 다른 worktree의 절대 경로를 가리키도록 이동합니다. 첫 번째에는 demo-ui, 두 번째에는 demo-tests를 연결합니다. 입력하는 경로는 자신의 폴더 위치에 맞게 확인하세요. 기본 설정에서는 ⌘ N으로 새 워크스페이스를 열고, ⌘ 1부터 ⌘ 9로 전환할 수 있습니다.[3]
각 워크스페이스에서 다시 상태를 확인합니다.
git status --short --branch
첫 번째 터미널에는 task/ui, 두 번째에는 task/tests가 표시되는지 살펴보세요. 기대한 브랜치가 아니라면 에이전트를 시작하기 전에 폴더를 바로잡습니다. 새로운 pane을 열었더라도 자동으로 다른 worktree가 선택되는 것은 아니므로 같은 확인이 필요합니다.

cmux 공식 Concepts 문서에서 워크스페이스와 pane을 설명하는 부분. (출처: cmux Docs, 2026-11-25 캡처)
이제 각 폴더에서 평소 사용하는 CLI 에이전트를 실행합니다. 이 글은 특정 에이전트 설치나 계정 설정을 대신하지 않습니다. 한쪽에는 UI 수정 범위를, 다른 쪽에는 테스트 범위를 알려 주고 공통 파일은 건드리지 않도록 요청하세요. 요청 문구는 작업 목적에 맞게 조정해야 하며, 지시만으로 실제 접근 권한이 강제되는 것은 아닙니다.
4. 결과를 각각 확인하기
작업이 끝나면 해당 worktree에서 먼저 상태와 변경 내용을 살펴봅니다.
git status --short --branch
git diff
git diff --check
git diff는 기본적으로 스테이징하지 않은 변경을 보여 줍니다. 이미 스테이징한 내용은 다음 명령으로 따로 확인하세요.[8]
git diff --cached
git diff --cached --check
--check가 통과해도 기능이 맞거나 안전하다는 뜻은 아닙니다. 프로젝트의 테스트와 빌드를 각 폴더에서 실행하고, 수정 범위와 테스트 결과를 사람이 검토해야 합니다. 새로 만들어져 아직 추적하지 않는 파일은 git diff만으로 보이지 않을 수 있으므로 git status도 함께 확인하세요.[7][8]
한 작업을 검토하고 반영한 뒤 다른 작업을 다시 비교하면 통합 시 겹치는 변경을 발견하기 쉽습니다. worktree를 삭제하기 전에는 변경 사항, 추적되지 않거나 무시된 파일, 필요한 백업과 원격 반영 여부를 직접 확인하세요. 무시된 로컬 설정과 데이터도 있을 수 있으므로 강제 삭제를 습관적으로 사용하지 않는 편이 안전합니다.[4]
분리해도 공유되는 것
- 기준 시점: 두 worktree는 생성할 때 지정한 커밋에서 시작합니다. 한쪽 브랜치의 새 커밋이 다른 쪽에 자동 반영되지는 않습니다.[4]
- Git 저장소: 체크아웃과 인덱스는 분리되지만 저장소의 여러 참조와 설정은 공유합니다. 브랜치 조작은 다른 worktree에도 영향을 줄 수 있습니다.[4]
- 실행 환경: worktree가 포트, 데이터베이스, 외부 API 계정이나 운영 데이터를 자동으로 격리하지는 않습니다. 개발 서버를 동시에 열면 각각 다른 포트를 사용하고, 테스트 데이터도 확인하세요.
- 의존성과 비밀값: 무시된 환경 파일과 설치된 의존성은 새 폴더에 없을 수 있습니다. 필요한 설정을 안전하게 준비하되 비밀값을 에이전트나 로그에 무심코 노출하지 마세요.
- 복구: cmux의 레이아웃 복원은 임의의 실행 중인 프로세스 메모리를 보존하는 기능이 아닙니다. 중요한 장기 작업은 별도 복구 방식을 계획하세요.[5]
cmux 알림은 여러 작업 중 확인이 필요한 곳을 찾는 데 도움이 될 수 있습니다. 다만 알림 표시는 사용하는 에이전트 연동과 앱 포커스, 시스템 권한 등에 따라 달라질 수 있으므로, 완료 여부를 알림 하나만으로 판단하지 마세요.[6]
정리
두 작업이 동시에 파일을 수정해야 한다면 각 worktree에 별도 브랜치를 두고 cmux 워크스페이스를 연결하세요. 각 터미널에서 경로와 브랜치를 확인한 뒤 작업하고, 결과는 폴더별로 검토합니다. 한 세션만 수정하고 나머지는 분석·리뷰만 한다면 worktree 없이 역할을 나누는 방법도 선택지입니다.
Sources
[1] https://cmux.com
[2] https://cmux.com/docs/concepts
[3] https://cmux.com/docs/keyboard-shortcuts
[4] https://git-scm.com/docs/git-worktree
[5] https://cmux.com/docs/session-restore
[6] https://cmux.com/docs/notifications
In the previous introduction to cmux, we looked at workspaces, split panes, and notifications. This time, we’ll cover how to manage two AI coding tasks side by side in cmux while using Git worktrees to separate their actual working directories.[1][4]
Splitting the screen is not the same as separating files. If two cmux panes point to the same directory, both agents edit the same files. Conversely, worktrees separate working files by branch, but they do not eliminate conflicts when the changes are combined later.[2][4]
The Git commands in this article were run on November 25, 2026, using Git 2.54.0 on macOS in a separate test repository. We verified that changes in the two directories remained separate and that a duplicate branch command produced an error. The cmux GUI, agent execution, and notifications were not reproduced directly; their descriptions are based on the official documentation.
What to separate first: the screen and the files
A cmux workspace is a unit of work that you switch between in the sidebar; a pane is a split region within it.[2] Git worktree creates separate working directories linked to one repository. Each directory can have a different branch checked out, but they share the Git repository and some configuration.[4]

Product screen from the official cmux website, showing how multiple tasks can be navigated through the sidebar and split panes. (Source: cmux, accessed 2026-11-24)
In this example, demo-repo is the original repository, while demo-ui and demo-tests are the directories for UI and test work, respectively. It is a good idea to assign files to each task beforehand and avoid changing shared configuration or lockfiles at the same time.
1. Check the base commit and scope of work
Before applying this to a real project, check the current branch and changed files in the original repository.
git status --short --branch
Use git status to check the branch and any changed or untracked files.[7] The base for the example below is the last commit currently checked out, HEAD. Uncommitted changes and files ignored by Git are not automatically copied to a new worktree. If needed work remains in the original directory, review it first and preserve important files safely.[4][7]
The example paths and branch names are intended for new entries. If a directory or branch with the same name already exists, choose a different name. Run the examples from the original repository directory.
2. Create a worktree for each task
These two commands create different branches and sibling directories based on the current HEAD.[4]
git worktree add -b task/ui ../demo-ui HEAD
git worktree add -b task/tests ../demo-tests HEAD
git worktree list
Check the list for the original directory, task/ui in demo-ui, and task/tests in demo-tests. Actual paths and commit IDs vary by environment. In the test repository, we confirmed that changing a file in demo-ui did not change the same file in demo-tests.
Git may reject an attempt to create a worktree with the same branch name again. In the example, the same -b command failed when task/ui already existed. Check the existing worktrees and branches, and use a new name. Do not reach for a force option first to get around the conflict.[4]
3. Connect each directory to cmux
Open new workspaces in cmux and navigate each terminal to the absolute path of a different worktree. Use demo-ui for the first and demo-tests for the second. Check the paths you enter against your own directory locations. With the default settings, ⌘ N opens a new workspace and ⌘ 1 through ⌘ 9 switch between workspaces.[3]
Check the status again in each workspace.
git status --short --branch
Check that the first terminal shows task/ui and the second shows task/tests. If a terminal is not on the expected branch, correct its directory before starting an agent. Opening a new pane does not automatically select a different worktree, so make the same check there too.

The section of the official cmux Concepts documentation explaining workspaces and panes. (Source: cmux Docs, captured 2026-11-25)
Now run your usual CLI agent in each directory. This article does not replace installation or account setup instructions for a particular agent. Tell one agent the scope of the UI changes and the other the scope of the tests, and ask them not to touch shared files. Adapt the prompts to your task; instructions alone do not enforce actual access permissions.
4. Review the results separately
When the work is complete, first inspect the status and changes in the corresponding worktree.
git status --short --branch
git diff
git diff --check
By default, git diff shows unstaged changes. Check anything already staged separately with the following commands.[8]
git diff --cached
git diff --cached --check
Passing --check does not mean the functionality is correct or safe. Run the project’s tests and build in each directory, and have a person review the scope of the changes and the test results. Newly created, untracked files may not appear in git diff alone, so check git status as well.[7][8]
Reviewing and integrating one task before comparing the other again makes it easier to spot overlapping changes during integration. Before removing a worktree, personally check its changes, untracked or ignored files, any needed backups, and whether its changes have been pushed to a remote. Ignored local settings and data may also be present, so it is safer not to use forced removal habitually.[4]
What remains shared despite the separation
- Starting point: Both worktrees start from the commit specified when they are created. New commits on one branch are not automatically reflected in the other.[4]
- Git repository: Checkouts and indexes are separate, but various repository references and settings are shared. Branch operations can affect other worktrees too.[4]
- Runtime environment: Worktrees do not automatically isolate ports, databases, external API accounts, or production data. Use different ports for simultaneous development servers and check the test data as well.
- Dependencies and secrets: Ignored environment files and installed dependencies may not be present in the new directories. Prepare the required configuration safely, and do not inadvertently expose secrets to agents or in logs.
- Recovery: cmux layout restoration does not preserve the memory of arbitrary running processes. Plan a separate recovery approach for important long-running work.[5]
cmux notifications can help you find which of several tasks needs attention. However, notification behavior can vary depending on the agent integration, app focus, and system permissions, so do not determine completion from a notification alone.[6]
Summary
If two tasks need to edit files at the same time, give each worktree a separate branch and connect it to a cmux workspace. Check the path and branch in each terminal before working, then review the results directory by directory. If only one session makes changes while the others only analyze or review, dividing roles without worktrees is another option.
Sources
[1] https://cmux.com
[2] https://cmux.com/docs/concepts
[3] https://cmux.com/docs/keyboard-shortcuts
[4] https://git-scm.com/docs/git-worktree
[5] https://cmux.com/docs/session-restore
[6] https://cmux.com/docs/notifications
在上一篇 cmux 介绍文章中,我们了解了工作区、分屏和通知。本文将介绍如何在 cmux 中并排管理两个 AI 编程任务,并使用 Git worktree 分离实际的工作文件夹。[1][4]
分屏和分离文件是两回事。如果 cmux 的两个 pane 指向同一个文件夹,两个智能体修改的就是同一批文件。反过来,worktree 虽然能按分支分离工作文件,却不能消除之后合并修改时的冲突。[2][4]
本文的 Git 命令于 2026年11月25日 在 macOS 的 Git 2.54.0 和一个独立的测试仓库中执行。我们验证了两个文件夹中的修改相互隔离,以及重复创建分支时的错误。cmux 的 GUI、智能体运行和通知并未实际复现,相关内容以官方文档为依据。
首先要分离的东西:屏幕和文件
cmux 的工作区是在侧边栏中切换的工作单元,pane 则是其中的分屏区域。[2] Git worktree 会创建连接到同一个仓库的独立工作文件夹。每个文件夹可以检出不同的分支,但它们共享 Git 仓库和部分设置。[4]

cmux 官方首页的产品界面,展示了如何通过侧边栏和分屏区域切换多个任务。(来源:cmux,2026-11-24 查阅)
本例以 demo-repo 为基准仓库,分别使用 demo-ui 和 demo-tests 作为 UI 和测试任务的文件夹。最好事先确定两个任务各自负责的文件,避免同时修改共享配置或锁文件。
1. 检查基准提交和工作范围
应用到实际工作之前,请在原始仓库中检查当前分支和已修改的文件。
git status --short --branch
git status 用于检查分支以及已修改和未跟踪的文件。[7] 以下示例以当前检出的最后一次提交 HEAD 为基准。未提交的修改或被 Git 忽略的文件不会自动复制到新的 worktree 中。如果原文件夹中还有需要保留的工作,请先检查并安全保存重要文件。[4][7]
示例中的路径和分支名称用于创建新项目。如果已有同名文件夹或分支,请另选名称。请在原始仓库文件夹中运行这些示例命令。
2. 为每个任务创建 worktree
以下两条命令以当前 HEAD 为基准,创建不同的分支和相邻文件夹。[4]
git worktree add -b task/ui ../demo-ui HEAD
git worktree add -b task/tests ../demo-tests HEAD
git worktree list
请在列表中确认原始文件夹、demo-ui 中的 task/ui 和 demo-tests 中的 task/tests。实际路径和提交 ID 因环境而异。在测试仓库中,我们确认了修改 demo-ui 的文件后,demo-tests 中的同一文件并未改变。
使用相同的分支名称再次创建时,Git 可能会拒绝。在示例中,当 task/ui 已存在时,相同的 -b 命令也执行失败。请检查现有的 worktree 和分支,并使用新名称。不要为了避免冲突而一开始就使用强制选项。[4]
3. 在 cmux 中连接各个文件夹
在 cmux 中打开新的工作区,并在各个终端中切换到不同 worktree 的绝对路径。第一个连接 demo-ui,第二个连接 demo-tests。输入路径时请根据自己的文件夹位置确认。默认设置下,可以用 ⌘ N 打开新工作区,用 ⌘ 1 到 ⌘ 9 切换工作区。[3]
在每个工作区中再次检查状态。
git status --short --branch
检查第一个终端是否显示 task/ui,第二个是否显示 task/tests。如果不是预期的分支,请在启动智能体之前切换到正确的文件夹。即使打开了新的 pane,也不会自动选中不同的 worktree,因此同样需要检查。

cmux 官方 Concepts 文档中介绍工作区和 pane 的部分。(来源:cmux Docs,2026-11-25 截图)
接下来,在各个文件夹中运行平时使用的 CLI 智能体。本文不介绍特定智能体的安装或账户设置。向一个智能体说明 UI 的修改范围,向另一个说明测试范围,并要求它们不要改动共享文件。提示语需要根据任务目的调整;仅凭指令并不能强制限制实际访问权限。
4. 分别检查结果
任务完成后,先在对应的 worktree 中检查状态和修改内容。
git status --short --branch
git diff
git diff --check
git diff 默认显示尚未暂存的修改。已暂存的内容请使用以下命令单独检查。[8]
git diff --cached
git diff --cached --check
即使 --check 通过,也不代表功能正确或安全。应在每个文件夹中运行项目的测试和构建,并由人工审查修改范围和测试结果。新建但尚未跟踪的文件可能不会仅通过 git diff 显示,因此也要检查 git status。[7][8]
先审查并合入一项任务,再重新比较另一项任务,更容易发现集成时重叠的修改。删除 worktree 之前,请亲自确认修改内容、未跟踪或被忽略的文件、必要的备份以及是否已推送到远程。被忽略的本地配置和数据也可能存在,因此不要习惯性地使用强制删除,这样更安全。[4]
分离后仍会共享的东西
- 基准时点:两个 worktree 从创建时指定的提交开始。一个分支的新提交不会自动反映到另一个分支。[4]
- Git 仓库:检出内容和索引是分离的,但仓库的多个引用和设置是共享的。分支操作也可能影响其他 worktree。[4]
- 运行环境:worktree 不会自动隔离端口、数据库、外部 API 账户或生产数据。同时启动开发服务器时,请使用不同的端口,并检查测试数据。
- 依赖与密钥:被忽略的环境文件和已安装的依赖可能不存在于新文件夹中。请安全地准备必要的配置,不要无意中向智能体或日志泄露密钥。
- 恢复:cmux 的布局恢复功能不会保留任意运行中进程的内存。请为重要的长期任务另行规划恢复方式。[5]
cmux 通知有助于在多个任务中找到需要关注的地方。不过,通知的显示可能因智能体集成、应用焦点和系统权限等因素而异,因此不要仅凭一条通知判断任务是否完成。[6]
总结
如果两个任务需要同时修改文件,请为每个 worktree 使用单独的分支,并连接 cmux 工作区。在每个终端确认路径和分支后再开始工作,结果也要按文件夹分别审查。如果只有一个会话修改文件,其余会话只做分析或审查,不使用 worktree 划分角色的方法也是一个选择。
Sources
[1] https://cmux.com
[2] https://cmux.com/docs/concepts
[3] https://cmux.com/docs/keyboard-shortcuts
[4] https://git-scm.com/docs/git-worktree
[5] https://cmux.com/docs/session-restore
[6] https://cmux.com/docs/notifications
前回のcmux紹介記事では、ワークスペース、画面分割、通知を見てきました。今回は、cmuxで2つのAIコーディング作業を並行して管理しながら、Git worktreeで実際の作業フォルダーを分離する方法を紹介します。[1][4]
画面を分けることと、ファイルを分けることは別です。cmuxの2つのpaneが同じフォルダーを指していれば、2つのエージェントは同じファイルを編集します。一方、worktreeはブランチごとに作業ファイルを分離しますが、後で変更を統合するときの競合までなくすわけではありません。[2][4]
この記事のGitコマンドは、2026年11月25日に、macOS上のGit 2.54.0と別途用意した試験用リポジトリで実行しました。2つのフォルダーの変更が分離されることと、ブランチ名の重複によるエラーを確認しています。cmuxのGUI、エージェントの実行、通知は直接再現しておらず、公式ドキュメントに基づいています。
まず分けるもの:画面とファイル
cmuxのワークスペースはサイドバーで切り替える作業単位で、paneはその中の分割領域です。[2] Git worktreeは、1つのリポジトリに紐づいた別々の作業フォルダーを作成します。各フォルダーでは異なるブランチをチェックアウトできますが、Gitリポジトリと一部の設定は共有されます。[4]

cmux公式サイトの製品画面。複数の作業をサイドバーと分割領域で切り替える様子が示されています。(出典:cmux、2026-11-24確認)
この例では、demo-repoを元のリポジトリとして、demo-uiとdemo-testsをそれぞれUI作業用とテスト作業用のフォルダーに使います。各作業の担当ファイルをあらかじめ決め、共通設定やロックファイルを同時に変更しないようにするとよいでしょう。
1. 基準コミットと作業範囲を確認する
実際の作業に適用する前に、元のリポジトリで現在のブランチと変更ファイルを確認してください。
git status --short --branch
git statusは、ブランチと変更済み・未追跡のファイルを確認するために使います。[7] 以下の例の基準は、現在チェックアウトしている最後のコミットHEADです。コミットしていない変更やGitが無視するファイルは、新しいworktreeに自動的にコピーされるわけではありません。必要な作業が元のフォルダーに残っている場合は、まず内容を確認し、重要なファイルを安全に保全してください。[4][7]
例に示すパスとブランチ名は、新しく作成する項目の名前です。同じ名前のフォルダーやブランチがすでに存在する場合は、別の名前を決めてください。例のコマンドは元のリポジトリのフォルダーで実行します。
2. 作業ごとにworktreeを作成する
2つのコマンドは、現在のHEADを基準に、異なるブランチと隣接するフォルダーを作成します。[4]
git worktree add -b task/ui ../demo-ui HEAD
git worktree add -b task/tests ../demo-tests HEAD
git worktree list
一覧で元のフォルダー、demo-uiのtask/ui、demo-testsのtask/testsを確認してください。実際のパスとコミットIDは環境によって異なります。試験用リポジトリでは、demo-uiのファイルを変更しても、demo-testsの同じファイルは変わらないことを確認しました。
同じブランチ名で再び作成しようとすると、Gitに拒否される場合があります。この例でも、task/uiがすでに存在するときに同じ-bコマンドを実行すると失敗しました。既存のworktreeとブランチを確認し、新しい名前を使ってください。衝突を避けるために、まず強制オプションを使うことはしないでください。[4]
3. 各フォルダーをcmuxに接続する
cmuxで新しいワークスペースを開き、それぞれのターミナルで異なるworktreeの絶対パスに移動します。1つ目にはdemo-ui、2つ目にはdemo-testsを接続します。入力するパスは、自分のフォルダーの場所に合わせて確認してください。デフォルト設定では、⌘ Nで新しいワークスペースを開き、⌘ 1から⌘ 9で切り替えられます。[3]
各ワークスペースで、もう一度状態を確認します。
git status --short --branch
1つ目のターミナルにtask/ui、2つ目にtask/testsが表示されるか確認してください。期待したブランチでなければ、エージェントを起動する前にフォルダーを修正します。新しいpaneを開いても自動的に別のworktreeが選ばれるわけではないため、同じ確認が必要です。

cmux公式のConceptsドキュメントで、ワークスペースとpaneを説明している箇所。(出典:cmux Docs、2026-11-25キャプチャ)
次に、各フォルダーで普段使っているCLIエージェントを実行します。この記事は、特定のエージェントのインストールやアカウント設定に代わるものではありません。一方にはUIの修正範囲を、もう一方にはテストの範囲を伝え、共通ファイルには手を加えないように依頼してください。依頼文は作業の目的に合わせて調整する必要があります。指示するだけでは、実際のアクセス権限は強制されません。
4. 結果をそれぞれ確認する
作業が終わったら、まず該当するworktreeで状態と変更内容を確認します。
git status --short --branch
git diff
git diff --check
git diffはデフォルトではステージングされていない変更を表示します。すでにステージングした内容は、次のコマンドで別途確認してください。[8]
git diff --cached
git diff --cached --check
--checkに問題がなくても、機能が正しい、あるいは安全であるとは限りません。各フォルダーでプロジェクトのテストとビルドを実行し、修正範囲とテスト結果を人が確認する必要があります。新規作成された未追跡のファイルはgit diffだけでは見えないことがあるため、git statusも併せて確認してください。[7][8]
一方の作業をレビューして取り込んだ後、もう一方を改めて比較すると、統合時に重複する変更を見つけやすくなります。worktreeを削除する前に、変更内容、未追跡または無視されたファイル、必要なバックアップ、リモートへの反映状況を自分で確認してください。無視されたローカル設定やデータも存在し得るため、強制削除を習慣的に使わないほうが安全です。[4]
分離しても共有されるもの
- 基準時点:2つのworktreeは、作成時に指定したコミットから始まります。一方のブランチの新しいコミットが、もう一方に自動反映されることはありません。[4]
- Gitリポジトリ:チェックアウトとインデックスは分離されますが、リポジトリのさまざまな参照や設定は共有されます。ブランチ操作が別のworktreeにも影響する場合があります。[4]
- 実行環境:worktreeはポート、データベース、外部APIアカウント、本番データを自動的に分離しません。開発サーバーを同時に起動する場合は異なるポートを使い、テストデータも確認してください。
- 依存関係と秘密情報:無視された環境ファイルやインストール済みの依存関係は、新しいフォルダーにはない場合があります。必要な設定を安全に用意し、秘密情報をエージェントやログに不用意に露出しないようにしてください。
- 復旧:cmuxのレイアウト復元は、実行中の任意のプロセスのメモリを保持する機能ではありません。重要な長時間作業には別の復旧方法を計画してください。[5]
cmuxの通知は、複数の作業の中から確認が必要なものを見つけるのに役立つ場合があります。ただし、通知の表示は使用するエージェントとの連携、アプリのフォーカス、システム権限などによって変わる場合があるため、通知だけで完了を判断しないでください。[6]
まとめ
2つの作業で同時にファイルを編集する必要がある場合は、各worktreeに別々のブランチを割り当て、cmuxワークスペースを接続してください。各ターミナルでパスとブランチを確認してから作業し、結果はフォルダーごとにレビューします。1つのセッションだけが変更を行い、残りは分析・レビューのみを行うなら、worktreeなしで役割を分担する方法も選択肢です。
Sources
[1] https://cmux.com
[2] https://cmux.com/docs/concepts
[3] https://cmux.com/docs/keyboard-shortcuts
[4] https://git-scm.com/docs/git-worktree
[5] https://cmux.com/docs/session-restore
[6] https://cmux.com/docs/notifications
En la introducción anterior a cmux vimos los espacios de trabajo, la división de pantalla y las notificaciones. Esta vez veremos cómo administrar dos tareas de programación con IA en paralelo en cmux y separar las carpetas de trabajo reales con Git worktree.[1][4]
Dividir la pantalla no es lo mismo que separar los archivos. Si dos paneles de cmux apuntan a la misma carpeta, ambos agentes modificarán los mismos archivos. A la inversa, los worktrees separan los archivos de trabajo por rama, pero no eliminan los conflictos que puedan surgir al integrar los cambios después.[2][4]
Los comandos de Git de este artículo se ejecutaron el 25 de noviembre de 2026, con Git 2.54.0 en macOS y en un repositorio de pruebas independiente. Comprobamos que los cambios de las dos carpetas permanecían separados y verificamos el error por duplicación de rama. La interfaz gráfica de cmux, la ejecución de agentes y las notificaciones no se reprodujeron directamente; la información sobre ellas se basa en la documentación oficial.
Qué separar primero: pantalla y archivos
Un espacio de trabajo de cmux es una unidad de trabajo entre las que se puede cambiar desde la barra lateral, y un panel es un área dividida dentro de ella.[2] Git worktree crea carpetas de trabajo independientes conectadas a un mismo repositorio. Cada carpeta puede tener una rama diferente extraída, aunque comparten el repositorio Git y parte de su configuración.[4]

Pantalla del producto en la página oficial de cmux. Muestra cómo cambiar entre varias tareas mediante la barra lateral y los paneles. (Fuente: cmux, consultada el 2026-11-24)
En este ejemplo, demo-repo es el repositorio de referencia, mientras que demo-ui y demo-tests son las carpetas para las tareas de interfaz y de pruebas, respectivamente. Conviene definir de antemano los archivos asignados a cada tarea y evitar que ambas modifiquen a la vez archivos de configuración compartidos o archivos de bloqueo.
1. Comprobar el commit de referencia y el alcance del trabajo
Antes de aplicar este método a un trabajo real, comprueba la rama actual y los archivos modificados en el repositorio original.
git status --short --branch
git status sirve para comprobar la rama y los archivos modificados o no rastreados.[7] El punto de partida del ejemplo es el último commit HEAD que está extraído actualmente. Los cambios sin confirmar y los archivos que Git ignora no se copian automáticamente al nuevo worktree. Si queda trabajo necesario en la carpeta original, revísalo primero y conserva los archivos importantes de forma segura.[4][7]
Las rutas y los nombres de rama del ejemplo se utilizan para crear elementos nuevos. Si ya existe una carpeta o rama con el mismo nombre, elige otro. Ejecuta los ejemplos desde la carpeta del repositorio original.
2. Crear un worktree para cada tarea
Los dos comandos crean ramas diferentes y carpetas vecinas a partir del HEAD actual.[4]
git worktree add -b task/ui ../demo-ui HEAD
git worktree add -b task/tests ../demo-tests HEAD
git worktree list
Comprueba en la lista la carpeta original, task/ui en demo-ui y task/tests en demo-tests. Las rutas y los ID de los commits varían según el entorno. En el repositorio de pruebas confirmamos que, después de modificar un archivo en demo-ui, el mismo archivo en demo-tests no había cambiado.
Git puede rechazar un nuevo intento de creación con el mismo nombre de rama. En el ejemplo, el mismo comando con -b falló cuando task/ui ya existía. Comprueba los worktrees y las ramas existentes y usa un nombre nuevo. No recurras primero a opciones forzadas para evitar el conflicto.[4]
3. Conectar cada carpeta en cmux
Abre nuevos espacios de trabajo en cmux y, en cada terminal, desplázate a la ruta absoluta de un worktree diferente. Conecta demo-ui en el primero y demo-tests en el segundo. Comprueba que las rutas que introduces coincidan con la ubicación de tus carpetas. Con la configuración predeterminada, ⌘ N abre un espacio de trabajo nuevo y ⌘ 1 a ⌘ 9 permiten cambiar entre ellos.[3]
Vuelve a comprobar el estado en cada espacio de trabajo.
git status --short --branch
Comprueba que el primer terminal muestre task/ui y el segundo task/tests. Si no aparece la rama esperada, corrige la carpeta antes de iniciar el agente. Aunque abras un panel nuevo, no se selecciona automáticamente otro worktree, por lo que es necesario hacer la misma comprobación.

Sección de la documentación oficial Concepts de cmux que explica los espacios de trabajo y los paneles. (Fuente: cmux Docs, captura del 2026-11-25)
Ahora ejecuta en cada carpeta el agente de línea de comandos que uses habitualmente. Este artículo no sustituye la instalación ni la configuración de la cuenta de ningún agente concreto. Indica a uno el alcance de las modificaciones de interfaz y al otro el de las pruebas, y pídeles que no toquen archivos compartidos. Ajusta las instrucciones al objetivo del trabajo: las instrucciones por sí solas no restringen los permisos de acceso reales.
4. Revisar cada resultado por separado
Cuando termine el trabajo, comprueba primero el estado y los cambios en el worktree correspondiente.
git status --short --branch
git diff
git diff --check
Por defecto, git diff muestra los cambios que no se han añadido al área de preparación. Revisa por separado los cambios ya preparados con los siguientes comandos.[8]
git diff --cached
git diff --cached --check
Que --check pase no significa que la funcionalidad sea correcta o segura. Ejecuta las pruebas y la compilación del proyecto en cada carpeta, y haz que una persona revise el alcance de los cambios y los resultados de las pruebas. Es posible que los archivos nuevos aún no rastreados no aparezcan solo con git diff, así que comprueba también git status.[7][8]
Revisar e integrar una tarea antes de volver a comparar la otra facilita detectar cambios solapados durante la integración. Antes de eliminar un worktree, comprueba personalmente los cambios, los archivos no rastreados o ignorados, las copias de seguridad necesarias y si los cambios se han enviado al remoto. También puede haber configuraciones locales y datos ignorados, por lo que es más seguro no usar la eliminación forzada por costumbre.[4]
Lo que sigue compartiéndose pese a la separación
- Punto de partida: los dos worktrees comienzan en el commit especificado al crearlos. Los nuevos commits de una rama no se reflejan automáticamente en la otra.[4]
- Repositorio Git: los archivos extraídos y los índices están separados, pero se comparten varias referencias y configuraciones del repositorio. Las operaciones sobre ramas también pueden afectar a otros worktrees.[4]
- Entorno de ejecución: los worktrees no aíslan automáticamente los puertos, las bases de datos, las cuentas de API externas ni los datos de producción. Si arrancas servidores de desarrollo a la vez, usa puertos distintos y comprueba también los datos de prueba.
- Dependencias y secretos: los archivos de entorno ignorados y las dependencias instaladas pueden no estar presentes en la nueva carpeta. Prepara de forma segura la configuración necesaria y evita exponer secretos inadvertidamente a los agentes o en los registros.
- Recuperación: la restauración del diseño de cmux no conserva la memoria de procesos arbitrarios que estén en ejecución. Planifica un método de recuperación independiente para los trabajos importantes de larga duración.[5]
Las notificaciones de cmux pueden ayudar a encontrar qué tarea necesita atención cuando hay varias en marcha. Sin embargo, su aparición puede depender de la integración del agente utilizado, del foco de la aplicación, de los permisos del sistema y de otros factores, así que no determines si una tarea ha terminado basándote únicamente en una notificación.[6]
Resumen
Si dos tareas necesitan modificar archivos simultáneamente, asigna una rama independiente a cada worktree y conecta los espacios de trabajo de cmux. Comprueba la ruta y la rama en cada terminal antes de trabajar y revisa los resultados por carpeta. Si solo una sesión modifica archivos y las demás se limitan al análisis o la revisión, también puedes optar por repartir los roles sin usar worktree.
Sources
[1] https://cmux.com
[2] https://cmux.com/docs/concepts
[3] https://cmux.com/docs/keyboard-shortcuts
[4] https://git-scm.com/docs/git-worktree
[5] https://cmux.com/docs/session-restore
[6] https://cmux.com/docs/notifications