1

Over my text I apply version control via git and I use the .gitignore file to place any file that is autogenerated on "compile" from tex to pdf.

Sometimes is nessasary to wipe out all theese file and keep the one you actually really need, because all these files are recorded in .gitignore one I want some magical way to do that. How is possible?

I usually keep the .bib files for bibliography and .tex for the actual content, also I keep and .png and .gif files for my text's image. My .gitignore is:

*.blg
*.out
*.pdf
*.log
*.bbl
*.aux
*.run.xml
*.synctex.gz
*.toc
*-blx.bib
*.swp
qt_temp.*
assets/.~lock.*#
dummy_for_stackeschange.*
sample*

I "compile" using TexStudio that runs the following compilation command:

xelatex -8bit -synctex=1 -interaction=nonstopmode --shell-escape %.tex

The tree structure is of the tracked files looks like:

|-- .
|--- content
|----- img1.png
|----- ...
|----- some other image.png
|--- material.bib
|--- assay.tex
|--- .gitignore
  • 1
    As it stands, this is a pure Git question so off-topic for us. – Joseph Wright Jun 14 '18 at 15:31
  • Well I believe yes and no because it may be focused on git but itended for tex authors where may have a little knowledge on git. Also I enchanced it in order to make it more tex-like. – Dimitrios Desyllas Jun 14 '18 at 15:35
  • 1
    How exactly do you compile? The latexmk tool has a clean feature, that can be extended to include extensions it does not already know to delete – daleif Jun 14 '18 at 15:35
  • updated the question in order to add extra info. Also you can add extra answer and spread the knowledge ;) – Dimitrios Desyllas Jun 14 '18 at 15:36
2

In my case I used the following command

git clean -xf

Where the command actually says "Remove anything untracked and anything that is in .gitignore files". So before running this command add/commit the files you need eg. images via:

git add ^file^
git commit -m "^Some change message^" ^files changed^

Also for images and anything binary use git lfs as well, theese files are usefull for further collaboration as well.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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