TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my PhD thesis under revision control (git), with a master file (~/Thesis/thesis.tex) using the \include command to include the chapters (~/Thesis/tex/chapter1.tex, etc).

Is there a way to include the revision information of each separate chapter in the header of each page for each respective chapter?

I thought I was getting somewhere with a combination of the gitinfo and fancyhdr packages, but I'm not sure if you can have different revision headers under gitinfo.

share|improve this question
You're correct; gitinfo only provides information for the current HEAD. I considered the approach you're suggesting, but it may be unsafe if, for example, you have a private style file in your project that affects the output, but doesn't actually "appear on a page". Knowing the revision id for the whole project does allow you to know exactly which versions of files were used, but obviously in a less-convenient manner. – Brent.Longborough Aug 5 '12 at 22:13
I have a similar problem - would be great to pull revision information of each include and display as a footer. – Forkrul Assail Oct 12 '12 at 13:37

Not directly, no; git doesn't distinguish between files (or something like that) and it doesn't store metadata on the last revision that affected each file.

I think the best option would be to write a post-commit hook that looked at the changed files and wrote a timestamp corresponding to each. E.g., iterate through the output of

git show --pretty="format:" --name-only master

and write a <filename>.datestamp file when each file is seen. This file could then be read directly into a header/footer to show when the chapter was lasted edited.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.