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 * 7a5c511 2013-10-06 | Updated Rakefile (greet) [Ismail Dhorat] * 815cf27 2013-10-06 | Hello uses Greeter [Ismail Dhorat] * 209ff42 2013-10-06 | Added greeter class [Ismail Dhorat] | * 313c04d 2013-10-06 | Added README (HEAD, master) [Ismail Dhorat] |/ * b3e19a3 2013-10-06 | Added a Rakefile. [Ismail Dhorat] * 14f09c0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat] * 1fed2ec 2013-10-06 | Add an author/email comment [Ismail Dhorat] * dc44f2e 2013-10-06 | Added a comment (v1) [Ismail Dhorat] * 5ec54fd 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat] * e606a20 2013-10-06 | Using ARGV [Ismail Dhorat] * 5d95e74 2013-10-06 | First Commit [Ismail Dhorat]
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.