I'm thinking to use git for my latex projects, and I'm wondering whether I should add the pdf output to the repositories, or leave it out. It would be sort of convenient to have it in there, but I'm worried that it would quickly use up lots of space, assuming that git basically will have to save each version in its entirety, as they are binary, or is there a reasonable way of having only small diffs?
Asked
Active
Viewed 5,076 times
6
-
2PDFs are mostly binary I'd say. I am git'ing sources (tex, svg etc) and Makefiles (everything like that). Why pdfs?.. – brownian Apr 19 '15 at 17:48
-
1@brownian Well, I thought I might give somebody else with less technical skill read access to the repository via some web interface, then that person would be able to see pdfs that way and give feedback. As an alternative I guess it would be possible to somehow autogenerate the pdfs for that purpose, not sure how long it would take to set that up, or just stick to manually sending pdfs via email. – muk.li Apr 19 '15 at 18:45
1 Answers
10
Don't. as a general rule of thumb, you should not commit generated files but only corresponding sources.
Check for example this source from Michael Ernst for details (quote):
Version control is intended for files that people edit. Generated files should not be committed to version control. For example, do not commit binary files that result from compilation, such as .o files or .class files. Also do not commit .pdf files that are generated from a text formatting application; as a rule, you should only commit the source files from which the .pdf files are generated.
kebs
- 859
-
To add to this answer: this discussion almost entirely agrees that committing things like images -- even ones that change -- to your repository can be good practice because you also need version control for those types of binary files. However, there is no reason to include a binary file which is entirely contained in your git repository through the text files: ie. .tex files contain all of the information (assuming you have a tex compiler) of the pdf, which is why you should not commit them. – Kraigolas Mar 09 '21 at 16:26