---
title: "合併、變基、揀選與還原"
description: "gitā 在執行合併、變基、揀選、還原或重置前會先展示將要發生的變化，執行過程中支援繼續、略過或中止，並內建衝突編輯器。"
url: https://getgita.app/zh-hant/features/merge-and-rebase
lang: zh-Hant
---

# 合併與變基，執行前先看清

凡是會拼接或改寫歷史的操作，都值得多看一眼。在 gitā 中，每一項操作都會先開啟一個視窗，明確說明即將發生什麼。

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

## 試試看

1. 在合併視窗中選擇一個分支。
2. 在三種合併方式之間切換。
3. 右鍵按一下歷史紀錄中的提交，查看 **揀選** 與 **還原**。

## 合併與變基

- **先看確認視窗.** 合併、變基、揀選、還原與重置都會先彈出視窗，寫明涉及的分支或提交。在你確認之前，什麼都不會改變。
- **三種合併方式.** 條件允許時快進、始終建立合併提交，或僅允許快進。可在「設定 ▸ Git」中選擇預設方式，一旁還有小動畫示範每種方式的效果。
- **編輯提交.** 「編輯此後的提交」即互動式變基。你可以將每筆提交設為保留、改寫訊息、編輯、壓縮、修正或捨棄，拖曳調整順序，gitā 會在執行前檢查方案。
- **繼續、略過、中止.** 操作進行期間，歷史紀錄上方會顯示目前進度列與未解決衝突的檔案數，並提供繼續、略過與中止按鈕。
- **衝突編輯器.** 發生衝突的檔案會同時展示共同祖先、目前版本與傳入版本，下方是可編輯的結果區。點按按鈕選用其中一方，或手動編輯結果，然後儲存並暫存。
- **帶計數提示的重置.** 重置到某筆提交時可選擇保留已暫存變更、保留工作區檔案或捨棄已追蹤變更。視窗會告訴你將影響多少個檔案，硬重置前還需先勾選確認。
- **二次校驗.** 在真正執行前，gitā 會再次確認儲存庫仍然停留在你剛才查看的那個分支與提交上。

## Questions, answered

### Can I resolve merge conflicts in gitā?

Yes. A conflicted file opens with the base, the current and the incoming version, and an editable result underneath. Take one side with a button or write the result yourself, then **Save & Stage**.

### Does gitā support interactive rebase?

Yes. **Edit Commits After This** is an interactive rebase: set each commit to pick, reword, edit, squash, fixup or drop, drag them into a new order, and gitā checks the plan before it runs.

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