Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read git log graph

In the git community book, it says

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.

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

like image 616
michael Avatar asked Mar 21 '11 18:03

michael


People also ask

What do the colors mean on git log graph?

The colors are merely meant to help you view the lines as distinct from other lines. To answer question #1, they are assigned not pseudo-randomly, but rather sequentially, each time git log --graph picks a new "column number".

What does git log tell you?

The git log command shows a list of all the commits made to a repository. You can see the hash of each Git commit, the message associated with each commit, and more metadata. This command is useful for displaying the history of a repository.


2 Answers

The asterisks show where something was committed:

e1193f8, 5a09431 and 30e367c were committed to the left branch (yielding a | on the right branch) whereas 420eac9 was committed to the right branch (yielding a | on the left branch). And that is how 420eac9 differs from the rest: it's the only commit to the right branch.

For the sake of completeness:

  • d6016bc was the branching point
  • 5e3ee11 is the merging commit
  • 2d3acf9 is the first commit after merging
like image 175
eckes Avatar answered Sep 18 '22 06:09

eckes


420eac9 is on a different branch than the 3 commits "below" it. The branches diverged after d6016bc and they were merged in 5e3ee11.

like image 40
Ilkka Avatar answered Sep 22 '22 06:09

Ilkka