Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
1  
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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.