27. View the different branches

Goals

  • 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.

Run:

git hist --all

Result:

$ 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 --graph of 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.

The --all flag guarantees that we see all the branches. By default, only the current branch is displayed.

SVN?
© 2011-2014 Git How To. All rights reserved / Contact us