I'm new to git and am using github for my remote rep. Is there a way to view all local commits and branches through a chart like when you view it in the github Network Graph Visualizer? More like a localhost version of github except it's for viewing commits (instead of using git log).
2 Answers
$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
It's really neat, the only difference it shows top to bottom rather then left to right.
run the following command
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
to create a global alias: git lg
You can find all my aliases at https://github.com/orefalo/bash-profiles/blob/master/git-config.sh
Comments
You can use the gitk history viewer. I believe it is provided by default with most installations of git. Simply type:
$ gitk
While the interface may appear slightly dated, it is completely functional.
NB: By default it will only show you the commit graph leading to the current branch/commit you are on. If you want to see the graph for all branches (as your question suggests, and as in GitHub's Insights-->Network view), you need to run gitk --all.
See the ProGit online book section on graphical interfaces for this and more details.