git 日志

你可以查看当前文件、项目目录或本地仓库的版本历史。

  • 要查看当前文件的历史版本,请访问Tools >Git >Current File 并选择Log of <file>
  • 要查看当前文件某个选区的版本历史记录,请转到Tools >Git >Current File 并选择Log of <file> Selection
  • 要查看当前项目目录的版本历史记录,请转到Tools >Git >Current Project Directory 并选择Log of <project directory name>
  • 要查看本地版本库的历史版本,请转到Tools >Git >Local Repository 并选择Log
  • 要查看目录及其子目录的日志,请在项目中右键单击该目录。

Git Log 视图会显示提交标识符、作者、日期和提交信息。

Git 日志中的提交详情

要设置显示日志条目的最大数量,请访问首选项>Version Control >Git >Log count

选择重新加载 (Reload) 重新扫描文件。

查看日志条目详细信息

Git Log 视图中,选择一个提交标识符以查看提交详细信息。

右键单击提交标识符可对提交应用操作。

菜单项说明了解更多
Add Tag for <hash>为更改添加标记引用。可以为标记添加注释。
Checkout <hash>查看无头状态下的提交。
Cherry-Pick <hash>将选定的提交筛选到当前分支。
Create branch from <hash>根据提交创建分支。git 分支
Copy <hash>将提交 <hash> 复制到剪贴板。
Describe Change <hash>Git Show 视图中查看修改描述,包括差异。
Diff Against <hash>显示提交和当前 HEAD 之间的改动。git diff
Interactive Rebase from <hash>在 <hash> 的基础上重置当前分支,并选择如何处理每个提交。交互式重置
Log for <hash>显示提交的版本历史。
Reset to Change <hash>重置工作目录到提交时的目录。git 重置
Revert <hash>还原该提交引入的更改。所有其他提交保持不变。
Save for Diff保存到当前提交,为Diff Against Saved <hash> 做准备。
Diff Against Saved <hash>显示提交和保存的 <hash> 之间的改动。git diff

切换差异视图

要切换差异视图,请选择Diff

使用耐心差异算法

要使用耐心差异算法计算差异,请选择Patience

忽略空白更改

要只显示文本更改,请选择Ignore Whitespace

过滤日志条目

按提交信息中的文本、添加或删除的字符串或作者过滤日志条目:

  1. Git Log 视图中,选择Filter
  2. Filter by messageFilter by contentFilter by author 中输入搜索字符串。
  3. 选择Case Sensitive 以考虑筛选情况。

显示所有本地分支的日志

要显示所有本地分支的日志(例如,查看触及文件的所有提交),请选择All

只跟随第一个父分支

要在合并提交时只跟随第一个父分支,请选择First Parent

切换文本和图形

要在日志的文本和可视化表示之间切换,请选择Graph

切换颜色

要切换日志条目不同部分的颜色编码,请选择Color

显示以前文件名的日志

要同时显示以前文件名的日志,请选择Follow

显示详细信息

要在Git Show 视图中显示包括差异在内的更改说明,请在右键菜单中选择Describe Change <hash>

Git Show 中的提交描述

另请参阅 如何使用 GitGit

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.