lab 27 Viewing Diverging Branches
Goals
- Learn how to view diverging branches in a repository.
View the Current Branches 01
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 * b59a8c2 2013-04-13 | Added README (HEAD, master) [Jim Weirich] | * 28917a4 2013-04-13 | Updated Rakefile (greet) [Jim Weirich] | * 4dac415 2013-04-13 | Hello uses Greeter [Jim Weirich] | * 39347b3 2013-04-13 | Added greeter class [Jim Weirich] |/ * 96ee164 2013-04-13 | Added a Rakefile. [Jim Weirich] * 0f36766 2013-04-13 | Moved hello.rb to lib [Jim Weirich] * eb30103 2013-04-13 | Add an author/email comment [Jim Weirich] * 1f7ec5e 2013-04-13 | Added a comment (v1) [Jim Weirich] * 582495a 2013-04-13 | Added a default value (v1-beta) [Jim Weirich] * 323e28d 2013-04-13 | Using ARGV [Jim Weirich] * 9416416 2013-04-13 | 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.