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
* 3f038a4 2018-09-28 | Updated Rakefile (greet) [Jim Weirich]
* fa0b537 2018-09-28 | Hello uses Greeter [Jim Weirich]
* 6f9af14 2018-09-28 | Added greeter class [Jim Weirich]
| * 5c40874 2018-09-28 | Added README (HEAD -> master) [Jim Weirich]
|/  
* 191f0c6 2018-09-28 | Added a Rakefile. [Jim Weirich]
* ef98cae 2018-09-28 | Moved hello.rb to lib [Jim Weirich]
* e1e08fd 2018-09-28 | Add an author/email comment [Jim Weirich]
* 7bf0bf1 2018-09-28 | Added a comment (tag: v1) [Jim Weirich]
* 9cf3f21 2018-09-28 | Added a default value (tag: v1-beta) [Jim Weirich]
* 94e1b8b 2018-09-28 | Using ARGV [Jim Weirich]
* f656098 2018-09-28 | 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.