---
title: "合并、变基、遴选与还原"
description: "gitā 在执行合并、变基、遴选、还原或重置前会先展示将要发生的变化，执行过程中支持继续、跳过或中止，并内置冲突编辑器。"
url: https://getgita.app/zh-hans/features/merge-and-rebase
lang: zh-Hans
---

# 合并与变基，执行前先看清

凡是会拼接或改写历史的操作，都值得多看一眼。在 gitā 中，每一项操作都会先打开一个弹窗，明确说明即将发生什么。

A live copy of the app is on the page: https://getgita.app/zh-hans/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-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
