Skip to content

lab 27 Viewing Diverging Branches

Goals

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.

Execute:

git hist --all

Output:

$ git hist --all
* 4721c3f 2020-05-30 | Updated Rakefile (greet) [Jim Weirich]
* 4689e1b 2020-05-30 | Hello uses Greeter [Jim Weirich]
* e685fb0 2020-05-30 | Added greeter class [Jim Weirich]
| * 32cb785 2020-05-30 | Added README (HEAD -> master) [Jim Weirich]
|/  
* 128a484 2020-05-30 | Added a Rakefile. [Jim Weirich]
* a3cf03d 2020-05-30 | Moved hello.rb to lib [Jim Weirich]
* 96c1fec 2020-05-30 | Add an author/email comment [Jim Weirich]
* 9811d9e 2020-05-30 | Added a comment (tag: v1) [Jim Weirich]
* 3344f03 2020-05-30 | Added a default value (tag: v1-beta) [Jim Weirich]
* 3cb4c15 2020-05-30 | Using ARGV [Jim Weirich]
* dfb5614 2020-05-30 | 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.