I would like to tell git ignore a file called foo.ext if and only if there is another file called foo.txe . I'm pretty sure this can't be done with the .gitignore syntax, but there can be other complicated ways that I don't think about?
Usage example: I often store LaTeX document data in a subdirectory named figures . And I usually draw my figures with Xfig. My makefile calls fig2dev to create a pair of files from the figures/foo.fig :
figures/foo.pdf , a PDF file for the graphic part,figures/foo.pdf_t , LaTeX file for text, with includegraphics command to include PDF.
Since these two files are generated, I would like git ignore them. I could add two simple exception patterns to my .gitignore file, but it also happens that some of my numbers are in a regular PDF file, not generated from another source. And of course, I would like git not to ignore these figures/bar.pdf .
I would like to add something like:
/\(**\)/figures/\(*\).fig: /\1/figures/\2.pdf /\1/figures/\2.pdf_t
to my .gitignore file, which means that any file named /<some_path>/figures/<some_name>.pdf or /<some_path>/figures/<some_name>.pdf_t should be ignored if and only if a file exists with named /<some_path>/figures/<some_name>.fig with the same <some_path> and <some_name> .
git gitignore
Renaud pacalet
source share