git commit
要将您的更改提交到 Git:
- 访问Tools >Git >Local Repository ,然后选择“Commit ”。

Git 提交视图General Information 显示了该提交的仓库和分支名称。
- 在Commit Information 中,查看并编辑更改作者的相关信息。
- 要绕过预提交和提交信息钩子,请选择“Bypass hooks ”。
- 如果您的项目使用签收机制,请选择Sign off ,以便在提交日志消息末尾添加由作者签署的“signed-off-by”尾注。
- 在“Description ”中,输入提交信息。
- 在“Files ”中,选择要包含在提交中的文件。
- 选择“Diff Selected Files ”以打开“Git Diff Files”视图,您可以在其中查看更改,并按块或按行将它们添加到暂存区。
- 选择“Commit ”开始提交。
要查看当前分支的日志,请在“Branch ”中选择分支名称。
对文件应用操作
在“Files ”中打开上下文菜单,对文件应用操作。所有文件均提供“Open in Editor ”和“Show in File System ”等操作。其他操作的可用性取决于所选文件的状态。
| 菜单项 | 描述 |
|---|---|
| Add | 将未受版本控制的文件添加到版本控制中。 |
| Stage | 将已修改的文件标记为待提交。 |
| Unstage | 取消将已修改文件标记为待提交。 |
| Remove | 删除未受版本控制的文件。 |
| Add to .gitignore | 将未受版本控制的文件添加到忽略列表中。 |
| Mark Untracked | 将已添加的文件标记为未受版本控制。 |
| Revert Unstaged Changes to <file> | 将已修改文件中未暂存的更改还原到先前状态。 |
| Revert All Changes to <file> | 将已修改文件中的所有更改还原为先前状态。 |
| Recover <file> | 恢复从版本控制中删除的文件。 |
| Run Merge Tool | 启动合并工具以解决文件中的冲突。 |
| Revert Renaming | 将重命名的文件恢复为之前的名称。 |
解决冲突
要解决冲突,请在发生冲突的文件的上下文菜单中选择“Run Merge Tool ”,借助合并工具解决冲突。您还可以选择以下选项之一:
| 菜单项 | 描述 |
|---|---|
| Resolve by Recovering | 从版本控制系统中恢复已删除的文件。 |
| Resolve by Removing | 从版本控制中删除文件。 |
| Resolve Conflicts with Ours | 选择我们版本的文件以解决合并冲突。 |
| Resolve Conflicts with Theirs | 选择对方的文件版本以解决合并冲突。 |
| Mark Conflicts Resolved | 手动解决冲突后,将文件标记为已解决。 |
另请参阅 《如何:使用 Git》和《Git 用法》。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.