27. View the different branches
- To learn how to view the different branches in the repository.
01 View current branches
Now we have a repository with two different branches. To view branches and their differences use log command as following.
git hist --all
$ git hist --all * 6c0f848 2011-03-09 | Added README (HEAD, master) [Marina Pushkova] | * 07a2a46 2011-03-09 | Updated index.html (style) [Marina Pushkova] | * 649d26c 2011-03-09 | Hello uses style.css [Marina Pushkova] | * 1f3cbd2 2011-03-09 | Added css stylesheet [Marina Pushkova] |/ * 8029c07 2011-03-09 | Added index.html. [Marina Pushkova] * 567948a 2011-03-09 | Moved hello.html to lib [Marina Pushkova] * 6a78635 2011-03-09 | Add an author/email comment [Marina Pushkova] * fa3c141 2011-03-09 | Added HTML header (v1) [Marina Pushkova] * 8c32287 2011-03-09 | Added standard HTML page tags (v1-beta) [Marina Pushkova] * 43628f7 2011-03-09 | Added h1 tag [Marina Pushkova] * 911e8c9 2011-03-09 | First Commit [Marina Pushkova]
We have opportunity to see
git hist in action. Adding the
--graph option to
git log causes building a commit tree with the help of simple ASCII characters. We see both branches (style and master) and that the current branch is master HEAD. The Added index.html branch goes prior to both branches.
--all flag guarantees that we see all the branches. By default, only the current branch is displayed.