I write my PhD thesises in LaTeX. Now I try to use git to track my project. Can somebody advice me good workflow of this process? Is it good idea to track image files and resulting .pdf by git?

  • 5
    I think this question is off-topic here as it is not about LaTeX but about git. pdf is a result so probably no the best to track. In case images are input data so they should be tracked. Also have a look at LSF (Large file storage possibilities of git). – albert Sep 6 '18 at 9:34
  • I'm sorry your question was closed, I thought parts of it were reasonable. For reference, you might like tex.stackexchange.com/questions/31103/… – cmhughes Sep 6 '18 at 15:28

I am currently in the same situation. Depending on the source of the images I consider two different options.

  1. The image was obtained as a pdf png or any other dead format. In this case, I track it in the repo since it is unlikekely to be modified. EDIT If the image was crated with Matlab I also keep the source fig file to keep the possibility to modify it later (which is still unlikely to happen).

  2. The image was built from pgf-tikz code say with pure tikz or pgfplots or pstricks , metapost and others. In that case, I just track the source files (raw data + code) to be able to reproduce it from any computer. EDIT I however add auxiliary files to the .gitignore as they are not required.

Finally, a side note regarding styles. When you have a lot of figures using common settings created with tikz, you can \input some style.tex file as a header for your figures, containing


This way you only have to change the definition of a given style in this file to change it in every picture, so the tracking of modifications is a bit easier.

| improve this answer | |

What should be the problem? I'd just make sure that the .gitignore will make sure that all those meta-files latex creates are not being uploaded to GitHub to keep a clean repository. As for images and PDFs there is no problem whatsoever with uploading them to GitHub. See here for a GitHub that hosts a LaTeX-document and some pictures.

| improve this answer | |
  • Thank you for your answer and example of GitHub repo. Of course I know about .gitignore. I asked about images and PDFs because I have heard that it is bad idea to include binary files to git, it causes significant increase of project size. But on the other hand, I want to be able to fully rollback my project to previous state, and image files are part of this "state". – Ybrs Sep 6 '18 at 10:07
  • 3
    Well you won't get diffs for anything but text files so if you change your images slightly git will simply pretend that you switched the whole thing completely, which I believe is the reason the repo will be ending up bigger than with pure text files. But as long as you are not having an awful lot of pictures that you intend to change in every commit, I'd say you're pretty much on the save side. – Raven Sep 6 '18 at 10:20

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