---
title: "Git 工作树"
description: "gitā 会列出仓库的工作树及其分支和智能体，支持在新工作树中检出分支，并将工作树的标签页与所属仓库归为一组。"
url: https://getgita.app/zh-hans/features/worktrees
lang: zh-Hans
---

# 多个分支 同时检出

工作树是为同一仓库另开一个文件夹来检出其他分支。它是多个智能体并行工作而不互相干扰的基础，gitā 将它们视作仓库的有机组成部分。

A live copy of the app is on the page: https://getgita.app/zh-hans/features/worktrees

## 试试看

1. 点击面板顶部的堆叠图标，列出尚未运行智能体的检出目录。
2. 展开某行工作树，查看其文件夹、分支和操作按钮。
3. 点击 **在历史中显示** 查看其对应分支。

## 工作树

- **与仓库一同列出.** 仓库的工作树会同时出现在侧边栏和“工作树与智能体”面板中，每条都标有分支和正在工作的智能体（如有）。
- **在新工作树中检出.** 从分支菜单中直接将其检出到独立的工作树，而无需打断当前手头的工作。“文件”菜单中的“新建工作树”可基于新分支直接创建。
- **每个工作树一个标签页.** 工作树会在独立标签页中打开，以仓库名和工作树名命名。开启相应设置后，它会自动与所属仓库的标签页归为一组。
- **已检出的分支.** 如果某个分支已经在工作树中检出，它的菜单会引导你打开那个标签页、在访达中显示文件夹或在那里打开终端，而不会重复检出。
- **安全移除.** 移除工作树时，如果发现有智能体正在其中工作会向你发出警告，且绝不会强行删掉你尚未提交的文件。

## Questions, answered

### Can I check out two branches at once?

Yes. From a branch's menu, check it out in a worktree of its own, a second folder for the same repository, and keep working where you are. Each worktree opens in its own tab.

### What happens to a worktree an agent is using?

Remove Worktree warns you if an agent is working there, and never forces away files you have not committed.

[全部功能](https://getgita.app/zh-hans/features.md)

- **下载 macOS 版:** https://github.com/rolottr/gita/releases/latest
- **在 GitHub 上查看:** https://github.com/rolottr/gita

---

Apple, macOS and Mac are trademarks of Apple Inc. Git is a trademark of Software Freedom Conservancy. GitHub is a trademark of GitHub, Inc. Vercel is a trademark of Vercel Inc. Claude is a trademark of Anthropic, PBC. gitā is independent software and is not affiliated with any of them. 问题反馈: https://github.com/rolottr/gita/issues
