Update: Version Control for Latex files

Github can be used to version control your tex files, which is handy if you are working on a large writing project, e.g. a dissertation. Here is a quick tutorial on how to include a footnote in your compiled tex files that tells you the git commit ID and the commit date. See also my first post here.

Install the gitinfo package for Latex. Next, initialize a new git repository, e.g. via the terminal and cd into the hooks folder.


git init
cd ./.git/hooks

Now, replace the files with these hooks (zip). I built them according to gitinfo package (documentation. Next, include this header into your Latex file:


\usepackage{gitinfo}
\title{Selection, Aggregation and Missing data}
\author{sumtxt\footnote{Last commit: \gitCommitterIsoDate\ Git-Hash: \gitAbbrevHash. Please do not distribute without the permission of the author.}}

and compile the tex files. The footnote (should) now read: “Last commit: 2013-01-03 22:09:06 +0100 Git-Hash: 4b23635. Please do not distribute without the permission of the author.”

Update (6/19/13): Some other useful advices here.


Version Control for Latex files

Git is not only a great tool to version control your code but also Latex files. Stackoverflow user yoda provides some excellent tipps for combining Latex and git. If you are looking for a way to tag your pdf files with the git hash or the most recent commit date, you might want to take a look at this Latex package. I use it to tag my pdfs with the corresponding git hash. That makes it hopefully easier in the future to match printouts to specific git commits.