[Tex/LaTex] Inserting git commit date without hooks

gitpackagesrevision control

Is there a way to insert the last git commit date into a document without having to add git hooks (like the gitinfo package does it)?

I'm not 100% sure how LaTeX packages work, but if they can access the current directory during compile-time and if they can execute external commands, that should easily be possible…

Best Answer

enter image description here

This is svn but any command line is the same.

Depending on your configuration you probably need

pdflatex --enable-write18 filename

to enable \write18 to be a hook to execute shell commands.

this writes to a temporary file using the shell escape, then inputs it

\documentclass{article}

\begin{document}

\immediate\write18{svn info \jobname.tex | grep "Changed Date" > \jobname.info }
\fbox{\input{\jobname.info}}

\end{document}
Related Question