提交第一次修改
在使用 Git 时,你通常会检查并整理本地修改,提交到本地版本库,然后推送到远程版本库(origin)。
开始之前,请在偏好设置 >Version Control >General 中设置 Git。
提交到新仓库
提交并推送第一次修改到新仓库:
- 要开始跟踪变更,请访问Tools >Git ,然后选择Create Repository 。
- 要查看本地变更,请访问Tools >Git >Local Repository ,然后选择Diff 。
Git Diff 仓库视图
- 右键单击已更改的行,选择Stage Chunk 将该块添加到暂存区,或选择Stage Selection 将所选行添加到暂存区。
- 要将暂存更改提交到本地仓库,请访问Tools >Git >Local Repository 并选择Commit 。
Git 提交视图
- 选择要提交的文件,然后选择Commit <n/m> File(s) 将更改提交到本地版本库。
- 要将提交的修改推送到远程仓库,请访问Tools >Git >Remote Repository 并选择Push 。
如果本地分支在远程版本库中没有上游分支,Qt Creator 会提示你创建该分支并将其设置为起源。
提交到现有版本库
提交并向现有版本库推送第一次修改:
- 要从远程版本库中提取变更,请访问Tools >Git >Remote Repository ,然后选择Pull 。
- 选择Stash & Pop 以在拉取之前隐藏所有本地变更,并在拉取的工作树状态之上应用你的隐藏变更。
- 要将更改提交到本地版本库,请转到Tools >Git >Local Repository ,然后选择Commit 。
- 要将提交的更改推送到远程仓库,请访问Tools >Git >Remote Repository 并选择Push 。
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.