I\'ve seen some books and articles have some really pretty looking graphs of git branches and commits. How can I make high-quality printable images of git history?
git -c core.pager='less -SRF' log --oneline --graph --decorate
This is my terminal variation, similar to many answers here. I like to adjust the flags passed to less
to prevent word wrapping.
I set this to an alias for quick access since the command is a bit cumbersome.
Many of the answers here are great, but for those that just want a simple one line to the point answer without having to setup aliases or anything extra, here it is:
git log --all --decorate --oneline --graph
Not everyone would be doing a git log
all the time, but when you need it just remember:
"A Dog" = git log --all --decorate --oneline --graph
There's a funky Git commit graph as one of the demos of the Raphael web graphics library.
The demo is static, but it should be easy enough to take the code and swap out their static data for a live set of data -- I think it's just Git commit data in JSON format.
The demo is here: http://dmitrybaranovskiy.github.io/raphael/github/impact.html
For more detailed textual output, please try:
git log --graph --date-order -C -M --pretty=format:"<%h> %ad [%an] %Cgreen%d%Creset %s" --all --date=short
You can write alias in $HOME/.gitconfig
[alias]
graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
Built on top of TikZ & PGF, gitdags is a little LaTeX package that allows you to effortlessly produce vector-graphics commit graphs, and more.
Automatic generation of an existing repository's commit graph is not the purpose of gitdags; the graphs it produces are only meant for educational purposes.
I often use it to produce graphs for my answers to Git questions, as an alternative to ASCII commit graphs:
Here is an example of such a graph demonstrating the effects of a simple rebase:
\documentclass{article}
\usepackage{subcaption}
\usepackage{gitdags}
\begin{document}
\begin{figure}
\begin{subfigure}[b]{\textwidth}
\centering
\begin{tikzpicture}
% Commit DAG
\gitDAG[grow right sep = 2em]{
A -- B -- {
C,
D -- E,
}
};
% Tag reference
\gittag
[v0p1] % node name
{v0.1} % node text
{above=of A} % node placement
{A} % target
% Remote branch
\gitremotebranch
[origmaster] % node name
{origin/master} % node text
{above=of C} % node placement
{C} % target
% Branch
\gitbranch
{master} % node name and text
{above=of E} % node placement
{E} % target
% HEAD reference
\gitHEAD
{above=of master} % node placement
{master} % target
\end{tikzpicture}
\subcaption{Before\ldots}
\end{subfigure}
\begin{subfigure}[b]{\textwidth}
\centering
\begin{tikzpicture}
\gitDAG[grow right sep = 2em]{
A -- B -- {
C -- D' -- E',
{[nodes=unreachable] D -- E },
}
};
% Tag reference
\gittag
[v0p1] % node name
{v0.1} % node text
{above=of A} % node placement
{A} % target
% Remote branch
\gitremotebranch
[origmaster] % node name
{origin/master} % node text
{above=of C} % node placement
{C} % target
% Branch
\gitbranch
{master} % node name and text
{above=of E'} % node placement
{E'} % target
% HEAD reference
\gitHEAD
{above=of master} % node placement
{master} % target
\end{tikzpicture}
\subcaption{\ldots{} and after \texttt{git rebase origin/master}}
\end{subfigure}
\caption{Demonstrating a typical \texttt{rebase}}
\end{figure}
\end{document}
I wrote a web tool for converting git logs into pretty SVG graphs: Bit-Booster - Offline Commit Graph Drawing Tool
Upload output from git log --pretty='%h|%p|%d'
directly into the tool and then click on the "download graph.svg" link.
The tool is pure-client-side, and so none of your Git data is shared with my server. You can also save the HTML + JS locally and run it using "file:///" URL's. Verified on Chrome 48 and Firefox 43 on Ubuntu 12.04.
It generates HTML that can be posted directly into any page (including the blogspot blogging engine!). Take a look at some of the blog posts here:
http://bit-booster.blogspot.ca/
Here's a screenshot of a sample HTML file generated by the tool:
http://bit-booster.com/graph.html (the tool)