Showing all branches and their relationships

Posted on Sun 01 November 2015 in Digging through history

To get a more "graphical" view of your branches, similar to what gitk and git gui provide, simply provide the following arguments to git log:

  • --oneline to summarize each commit in one line
  • --graph to draw lines between connected commits
  • --decorate to show branch/tag names
  • --all to process all branches and tags

The output looks somewhat like this:

$ git log --oneline --graph --decorate --all
* 928e747 (HEAD -> master, origin/master, origin/HEAD) set_ers_direct_connect: password wasn't passed correctly
| * 66b4165 (origin/debian, debian) New debian package
| *   24deb65 Merge tag '3.3' into debian
| |\  
| |/  
|/|   
| * c58e62c New debian package
| *   7d3a9ce Merge tag '3.2' into debian
| |\  
| * | a70c56d New debian package
| * |   6509932 Merge tag '3.1' into debian
| |\ \  
| * | | ff1214f New debian package
| * | |   19e8dc2 Merge tag '3.0' into debian
| |\ \ \  
| * | | | a161e09 (duncanwebb/debian) New debian package
| * | | |   6428b02 Merge tag '2.13.1' into debian
| |\ \ \ \  
| * | | | | 6ae54b1 New debian package
| * | | | |   d22ee26 Merge tag '2.13' into debian