重置索引
Git 使用索引来记录更改。索引会在下一次提交时提交。Git 允许你还原到上次提交时的状态以及索引中的状态。
重置当前文件中所有未提交的修改
要撤销所有未提交的修改,并将当前文件重置为索引状态,请访问Tools >Git >Current File 并选择Undo Unstaged Changes for <file> 。
要将当前文件恢复到上次提交后的状态,请选择Undo Uncommitted Changes for <file> 。这将还原所有更改,并丢弃索引。
重置本地版本库中的更改
要重置本地版本库中的更改,请访问Tools >Git >Local Repository ,然后选择Reset 。
选择要重置工作目录的提交。例如,这在应用补丁进行审查后非常有用。
选择重置类型:
- Hard 重置会丢弃对工作树中跟踪文件的所有更改。
有关如何恢复意外删除的提交的更多信息,请参阅git reflog。
- Mixed reset 撤销选中的提交并取消所有更改,但保持工作树不变。
- Soft reset 撤销选中的提交,但保持所有已暂存的更改和工作树不变。
要恢复已删除的文件,请选择Recover Deleted Files 。
在编辑器中还原提交
要还原当前悬停的提交,请在注释视图中选择Revert <hash> 。
注释视图中的即时责备操作
您会被要求确认还原。
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.