lab 27 Viewing Diverging Branches
- 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.
git hist --all
$ git hist --all * 12414e9 2014-10-25 | Updated Rakefile (greet) [Jim Weirich] * 43ba308 2014-10-25 | Hello uses Greeter [Jim Weirich] * acd8535 2014-10-25 | Added greeter class [Jim Weirich] | * 6fd9eff 2014-10-25 | Added README (HEAD, master) [Jim Weirich] |/ * 14ba469 2014-10-25 | Added a Rakefile. [Jim Weirich] * 4b249b3 2014-10-25 | Moved hello.rb to lib [Jim Weirich] * bfd1408 2014-10-25 | Add an author/email comment [Jim Weirich] * a1189df 2014-10-25 | Added a comment (tag: v1) [Jim Weirich] * 6083cb8 2014-10-25 | Added a default value (tag: v1-beta) [Jim Weirich] * b24f3ff 2014-10-25 | Using ARGV [Jim Weirich] * cf466b4 2014-10-25 | 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.
--all flag makes sure that we see all the branches. The default is to show only the current branch.