Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.4k points)

I'm playing with git in isolation on my own machine, and I find it difficult to maintain a mental model of all my branches and commits. I know I can do a git log to see the commit history from where I am, but is there a way to see the entire branch topography, something like these ASCII maps that seem to be used everywhere for explaining branches?

      .-A---M---N---O---P

     /     /   /   /   /

    I     B   C   D   E

     \   /   /   /   /

      `-------------'

It just feels like someone coming along and trying to pick up my repository would have difficulty working out exactly what was going on.

1 Answer

0 votes
by (27.5k points)

The following commands should do the magic:

$ git log --graph

or

$ gitk. 

Also, both of these commands accept --all, which will show all the branches instead of just the current one.

But if you want to get branch names and a compact view:

$ git log --graph --decorate --oneline

Browse Categories

...