git 如何读取git日志图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5382255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:25:47  来源:igfitidea点击:

How to read git log graph

gitgit-branchgit-log

提问by michael

In the git community book, it says

在 git 社区书中,它说

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.

您可以做的另一件有趣的事情是使用“--graph”选项可视化提交图,如下所示:

$ 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

它将为提交历史行提供一个非常好的 ASCII 表示。

How should I read this graph? How does 420eac9differ from the rest?

我应该如何阅读这张图表?如何420eac9从剩下的有什么不同?

回答by eckes

The asterisks show where something was committed:

星号显示提交的地方:

e1193f8, 5a09431and 30e367cwere committed to the left branch (yielding a |on the right branch) whereas 420eac9was committed to the right branch (yielding a |on the left branch). And thatis what 420eac9does different from the rest: it's the only commit to the right branch.

e1193f85a0943130e367c提交到左支(得到|的分支,在右侧),而420eac9致力于右支(产生|在左分支)。而正是420eac9从其他地方根本不同:它是唯一承诺分支,在右侧。

For the sake of completeness:

为了完整起见:

  • d6016bcwas the branching point
  • 5e3ee11is the merging commit
  • 2d3acf9is the first commit after merging
  • d6016bc是分支点
  • 5e3ee11是合并提交
  • 2d3acf9是合并后的第一次提交

回答by Ilkka

420eac9is on a different branch than the 3 commits "below" it. The branches diverged after d6016bcand they were merged in 5e3ee11.

420eac9与“下面”的 3 个提交位于不同的分支上。之后分支分叉,d6016bc然后合并到5e3ee11.