I have a git repo in which I store my personal documents. Some of these documents are LaTeX files and some even are PDFs. I of course want them to be in my documents repo.
But when I create an org-mode document (*.org
), I often build it, resulting in these files being created if the org-mode document is called α
:
- α.tex
- α.pdf
- auto/α.el
I don't want to track them as they are generated files of which I have the source code but I can't simply ignore all *.tex
and not even all *.pdf
files.
Can a .gitignore
be told to ignore every file whose name is α.tex
or α.pdf
if there is a file called α.org
with α
being a variable for an arbitrary string?
This is not possible,
.gitignore
is quite simple file and doesn't allow any conditional rules.However, generally good idea is to prepare the build system to generate all the intermediate files into some build directory. Often is used
build
ortarget
. Then you could simply put into.gitignore
:If the compiling is done with Makefile, the rules can look like:
(not sure so much about syntax for latex and of course the specific command for generating
*.tex
from*.org
)