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.

As question says, I am just interested to know the pros and cons of keeping track of auxiliary files of a LaTeX project in every commit of git repository.

share|improve this question
7  
Cons: assume you edit the .tex, commit, but not compile. Now your snapshot has .tex and .aux "in disagreement". Pros: can't see anything. –  mbork May 8 '13 at 0:57
2  
The only benefit I can see is if for some reason, you've edited one of these auxiliary files manually. –  Xavier May 8 '13 at 4:09
    
Related question: tex.stackexchange.com/q/17845/86 –  Loop Space May 8 '13 at 8:51

1 Answer 1

up vote 16 down vote accepted

The files that you are talking about (.log, .aux., .bbl., .blg, .toc, etc.) are created by LaTeX (or BibTeX, or any other auxiliary program) “on the fly.” They are usually dependent on the source .tex file. Since there's no information in those files that's unique to them (i.e., that can't be recovered from the source .tex file) and you would never edit them manually, there's no advantage to versioning them. At best, you commit a file that can be replicated byte-for-byte from another process, which is redundant. At worst, as mbork points out, if you commit the .tex file without compiling (and producing new auxiliary files), you are committing out-of-date information.

On the contrary, I would exclude those files from version control. In .git you can do this by creating a file .gitignore in the repository directory. In that file put patterns of the auxiliary files you want to ignore. Here is a list that I typically use:

# TeX, snapshot, and latexmk generated files
*.aux
*.dep
*.fdb_latexmk
*.log
*.out
*.synctex.gz
*.log
*.fls

You can also put these patterns in the git directory within the repository .git/info/exclude. I have a git template that has such an exclude file in it, then when I want to gitify a new document I run

$ git init --template=/path/to/template

and I'm done.

You can also do this globally. See Ignoring Files from GitHub Help.

share|improve this answer
3  
Worth saying why there's no advantage. The point is that LaTeX or BibTeX will generate these files whenever they are run, so there's no point in versionning them as you can always recover them from existing files. The point of putting a file under version control is to be able to restore it if you make a mistake, but as it is autogenerated it is unlikely that you are editing it itself, and as it is generated by LaTeX then you can always get it back by running latex. –  Loop Space May 8 '13 at 8:54
    
@AndrewStacey: You're absolutely right. With the benefit of some sleep I was able to expound from my original answer. –  Matthew Leingang May 8 '13 at 11:45

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.