My workflow with gitdags

As I wrote in my last post, I like to use the LaTeX package gitdags when a visual representation of an exemplary git graph is needed.

In this post, I shortly show my workflow when creating these graphs.



      % Commit DAG
      \gitDAG[grow right sep = 2em]{
        A -- B -- C


produces this graph

Simple Commits

The import thing to note here is the chosen documentclass which crops the resulting pdf to be as big as the content.


When running pdflatex graph.tex you would get such a pdf. To convert the pdf into a png, I use ImageMagick. On a Mac, it’s as easy to get as to type

$ brew install imagemagick

Then, for converting the pdf into png, use ImageMagicks convert method.

$ convert graph.pdf graph.png

I wrote a small bash script which lets me specify input and ouput directories, does the conversion from tex to png and later throws away all pdf generation files.

A Makefile would probably be much better as it would only build files which changed, not the whole directory. As for now, I will stick with the bash script given that the amount of files is rather small. If I ever switch to Make, I’ll update this post accordingly.

Written by Hendrik Purmann

Software engineer, computer science student and hobby photographer from Berlin