To be precise, there is a project with a bunch of *.el and *.org files. When executed, from every file.org a file.el is generated. Now the .gitignore is being written. Is there a possibility to say that any file.el shall be ignored only if file.org is there, otherwise track file.el
This does not solve it. Neither does writing every single file in the .gitignore
Not with gitignore (I don't know of conditional ignore rules).
A workaround would be a bash script (works even on Windows) which would:
file.el
file.org
existsgit update-index --no-assume-unchanged file.el
(or git skip-worktree --no-assume-unchanged file.el
: see "Difference Between 'assume-unchanged
' and 'skip-worktree
'"
But, as commented, it would be easier to separate generate from dist files, with only the former to be ignored.