---
title: "Git 工作樹"
description: "gitā 會列出儲存庫的工作樹及其分支與代理，支援在新工作樹中檢出分支，並將工作樹的標籤頁與所屬儲存庫歸為一組。"
url: https://getgita.app/zh-hant/features/worktrees
lang: zh-Hant
---

# 多個分支 同時檢出

工作樹是為同一儲存庫另開一個資料夾來檢出其他分支。它是多個代理平行工作而不互相干擾的基礎，gitā 將它們視作儲存庫的有機組成部分。

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

## 試試看

1. 按一下面板頂部的堆疊圖示，列出尚未執行代理的檢出目錄。
2. 展開某列工作樹，查看其資料夾、分支與操作按鈕。
3. 按一下 **在歷史中顯示** 查看其對應分支。

## 工作樹

- **與儲存庫一同列出.** 儲存庫的工作樹會同時出現在側邊欄與「工作樹與代理」面板中，每列都標有分支與正在工作的代理（如有）。
- **在新工作樹中檢出.** 從分支選單中直接將其檢出到獨立的工作樹，而無需打斷目前手頭的工作。「檔案」選單中的「新增工作樹」可基於新分支直接建立。
- **每個工作樹一個標籤頁.** 工作樹會在獨立標籤頁中開啟，以儲存庫名稱與工作樹名稱命名。開啟相應設定後，它會自動與所屬儲存庫的標籤頁歸為一組。
- **已檢出的分支.** 如果某個分支已經在工作樹中檢出，它的選單會引導你開啟那個標籤頁、在 Finder 中顯示資料夾或在那裡開啟終端機，而不會重複檢出。
- **安全移除.** 移除工作樹時，如果發現有代理正在其中工作會向你發出警告，且絕不會強行刪掉你尚未提交的檔案。

## 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-hant/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
