---
title: "暫存檔案與區塊"
description: "在 gitā 中暫存整個檔案或單一區塊，以樹狀圖或平面清單查看未暫存與已暫存變更，並在關閉視窗後依然保留未寫完的提交訊息。"
url: https://getgita.app/zh-hant/features/staging
lang: zh-Hant
---

# 暫存整個檔案，或單一區塊

「本機變更」會展示你修改過的內容，清晰區分為已暫存與未暫存兩部分，並在一旁顯示差異對比。

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

## 試試看

1. 按一下一個檔案查看它的差異對比。
2. 按一下差異區塊上方的 **暫存區塊**，只暫存那一部分變更。
3. 按一下 **全部暫存**，輸入提交訊息，然後按一下 **提交已暫存變更**。
4. 使用過濾框旁的按鈕在樹狀檢視與平面清單之間切換。

## 暫存

- **上方未暫存，下方已暫存.** 兩個清單完全契合 git 的工作方式。選取一個或多個檔案，透過「暫存」或「取消暫存」在兩欄間移動。
- **一次一個區塊.** 按一下差異中的某個區塊，只暫存該區塊，讓每次提交都專注於單一改動。
- **樹狀或平面清單.** 依資料夾層級查看變更檔案，或切換為純路徑清單，並支援依名稱過濾。每個檔案都標有已修改、新增、刪除、重新命名或衝突狀態。
- **不會遺失的提交訊息.** 如果你寫了一半提交訊息後關閉了標籤頁、視窗或整個應用程式，回來時它依然完好無損。每個工作樹都有獨立的草稿。
- **每個檔案都有選單.** 可以直接開啟檔案、用其他應用程式開啟、在 Finder 中顯示、放棄變更、查看歷史紀錄或複製路徑。
- **暫存區（Stash）.** 附帶說明將目前變更暫時擱置到一旁。之後在側邊欄選取該 Stash 即可查看內容並套用。

## Questions, answered

### Can I stage only part of a file?

Yes. Click in a block of the diff and **Stage hunk** stages only that part, so one commit holds one idea.

### Do I lose my commit message if I close the window?

No. If you start a commit message and close the tab, the window or the app, it is still there when you come back. There is a draft for each worktree.

[全部功能](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
