lab 25 Viewing Diverging Branches
Goals
- Learn how to view diverging branches in a repository.
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 * 3aa3064 2019-06-27 | Added README (HEAD -> main) [Halle Bot] | * f52644d 2019-06-27 | Updated package (greet) [Halle Bot] | * 455c54f 2019-06-27 | Hello uses Greeter [Halle Bot] | * 4fb8bde 2019-06-27 | Added greeter class [Halle Bot] |/ * 2b04803 2019-06-27 | Added a package.json. [Halle Bot] * b65b430 2019-06-27 | Moved hello.js to lib [Halle Bot] * 4535421 2019-06-27 | Add an author/email comment [Halle Bot] * 59992ce 2019-06-27 | Added a comment (tag: v1) [Halle Bot] * 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot] * 6915d41 2019-06-27 | Using process.argv [Halle Bot] * 284070d 2019-06-27 | First Commit [Halle Bot]
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 main), and that the main 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.