Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to set up a global .gitignore file in my home suitable for working with TeX files. So typical TeX junk files such as *.log, *.aux, *.synctex.gz would go in it.

The next step, however, is ignoring the compiled somefile.pdf if the source file somefile.tex is present. So my question is:

Is there a syntax in .gitignore that I can use to tell it to ignore somefile.pdf only if somefile.tex is present?

share|improve this question
up vote 2 down vote accepted

No, I don't see this feature in gitignore man page.

I would rather:

  • ignore all *.pdf in your global .gitignore file
  • run periodically a script updating a .gitignore file in any directory where a pdf file is found without a matching .tex file


That would make the 'afile.pdf' not ignored in that specific directory.

share|improve this answer
Not the answer that I hoped for, but "no" is still an answer. Accepting this, thanks. – Federico Poloni Apr 3 '12 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .