Skip to content

lab 27 Viewing Diverging Branches


View the Current Branches

We now have two diverging branches in the repository. Use the following log command to view the branches and how they diverge.


git hist --all


$ git hist --all
* 69a8d70 2019-11-01 | Updated Rakefile (greet) [Jim Weirich]
* 7b8b268 2019-11-01 | Hello uses Greeter [Jim Weirich]
* f84663f 2019-11-01 | Added greeter class [Jim Weirich]
| * 099ccd0 2019-11-01 | Added README (HEAD -> master) [Jim Weirich]
* ed35144 2019-11-01 | Added a Rakefile. [Jim Weirich]
* 4421854 2019-11-01 | Moved hello.rb to lib [Jim Weirich]
* 185fc95 2019-11-01 | Add an author/email comment [Jim Weirich]
* 4d578d4 2019-11-01 | Added a comment (tag: v1) [Jim Weirich]
* dc1d42f 2019-11-01 | Added a default value (tag: v1-beta) [Jim Weirich]
* 9a1c494 2019-11-01 | Using ARGV [Jim Weirich]
* 063b40e 2019-11-01 | First Commit [Jim Weirich]

Here is our first chance to see the --graph option on git hist in action. Adding the --graph option to git log causes it to draw the commit tree using simple ASCII characters. We can see both branches (greet and master), and that the master branch is the current HEAD. The common ancestor to both branches is the “Added a Rakefile” branch.

The --all flag makes sure that we see all the branches. The default is to show only the current branch.