lab 24 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 * 6179ba3 2023-08-21 | Added README (HEAD -> main) [Théophile Chevalier] | * cc98109 2023-08-21 | Hello uses Greeter (greet) [Théophile Chevalier] | * d6aae18 2023-08-21 | Add greeter class [Théophile Chevalier] |/ * 9ab61ca 2023-08-21 | Moved hello.py to lib [Théophile Chevalier] * 7abea37 2023-08-21 | Add an author/email comment [Théophile Chevalier] * 1c410c6 2023-08-21 | Add a comment (tag: v1) [Théophile Chevalier] * 0bf384c 2023-08-21 | Display user input (tag: v1-beta) [Théophile Chevalier] * 31c3945 2023-08-21 | Add some content [Théophile Chevalier] * aa5d425 2023-08-21 | First Commit [Théophile Chevalier]
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.