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
* 8d90176 2020-06-20 | Added README (HEAD -> master) [Jim Weirich]
| * 228a31e 2020-06-20 | Updated Rakefile (greet) [Jim Weirich]
| * 98cfd8a 2020-06-20 | Hello uses Greeter [Jim Weirich]
| * cf0438b 2020-06-20 | Added greeter class [Jim Weirich]
* 5aec14d 2020-06-20 | Added a Rakefile. [Jim Weirich]
* 721b979 2020-06-20 | Moved hello.rb to lib [Jim Weirich]
* 907a445 2020-06-20 | Add an author/email comment [Jim Weirich]
* 4254c94 2020-06-20 | Added a comment (tag: v1) [Jim Weirich]
* c8b3af1 2020-06-20 | Added a default value (tag: v1-beta) [Jim Weirich]
* 30c2cd4 2020-06-20 | Using ARGV [Jim Weirich]
* 4445720 2020-06-20 | 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.