Graphs
The
--graph
option draws an ASCII graph representing the branch structure of the commit history. This is commonly used in conjunction with the --oneline
and --decorate
commands to make it easier to see which commit belongs to which branch:git log --graph --oneline --decorate
For a simple repository with just 2 branches, this will produce the following:
* 0e25143 (HEAD, master) Merge branch 'feature'
|\
| * 16b36c6 Fix a bug in the new feature
| * 23ad9ad Start a new feature
* | ad8621a Fix a critical security issue
|/
* 400e4b7 Fix typos in the documentation
* 160e224 Add the initial code base
The asterisk shows which branch the commit was on, so the above graph tells us that the
23ad9ad
and 16b36c6
commits are on a topic branch and the rest are on the master
branch.
While this is a nice option for simple repositories, you’re probably better off with a more full-featured visualization tool like
gitk
orSourceTree for projects that are heavily branched.
留言