git - 如何阅读 git 日志图

标签 git git-branch git-log

在 git community book 中,它说

Another interesting thing you can do is visualize the commit graph with the '--graph' option, like so:

$ git log --pretty=format:'%h : %s' --graph
* 2d3acf9 : ignore errors from SIGCHLD on trap
*   5e3ee11 : Merge branch 'master' of git://github.com/dustin/grit
|\
| * 420eac9 : Added a method for getting the current branch.
* | 30e367c : timeout code and tests
* | 5a09431 : add timeout protection to grit
* | e1193f8 : support for heads with slashes in them
|/
* d6016bc : require time for xmlschema

It will give a pretty nice ASCII representation of the commit history lines.

我应该如何阅读这张图? 420eac9 与其他部分有何不同?

最佳答案

星号表示提交的地方:

e1193f85a0943130e367c 被提交到左分支(在右分支上产生 | ) 而 420eac9 被提交到右分支(在左分支上产生一个 |)。 就是 420eac9 与其他分支的不同之处:它是对正确分支的唯一提交。

为了完整起见:

  • d6016bc 是分支点
  • 5e3ee11 是 merge 提交
  • 2d3acf9 是 merge 后的第一次提交

关于git - 如何阅读 git 日志图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5382255/

相关文章:

Git:相当于 `--full-history` 和 `git bisect` 的 `git blame`

git - 为什么 git 标签没有出现在任何分支上?

git - 仅在 Git 中为子目录切换分支

git - stash 后出现的 'WIP' 和 'index' 提交是什么?

git - 如何仅使用管道命令访问 git log --stat 中显示的信息?

git - 如何在 git 中跟踪特定修订版上未修改的文件?

git - 无法将文件添加到 Git 存储库

Git 认为我重命名了一个文件而不是删除一个文件并创建另一个文件

git - 如何使用 .gitignore 在 git 中只包含特定文件夹?

git - Git日志的-r选项有什么作用?