TL;DR: I want a submodule to ignore some files, but I want those files tracked by the parent project
Details
This is for a Unity project. I want to add a bunch of code and assets I frequently used into a submodule, so I can easily share it between projects.
The problem is that Unity needs to keep track of ".meta" files, that get stored along each asset. And these .meta files are unique for each project, so they can't be shared through the submodule.
So, I added a .gitignore file into the submodule, telling it not to track .meta files
So far things go as planned. I added the submodule into the project, and it correctly ignores the project's meta files. However, although I need to commit those into the main git repository, anything under the submodule is getting ignored, so I can't add the meta files into the main repository.
Example:
Assets
L Game Files
L some_asset.jpg
L some_asset.jpg.meta
L Submodule
L shared_asset.jpg
L shared_asset.jpg.meta
In this scenario, I want the main git repository to track:
Assets
L Game Files
L some_asset.jpg
L some_asset.jpg.meta
L Submodule
L shared_asset.jpg.meta
And the submodule:
shared_asset.jpg
I combed the web, I tried different .gitignore combinations but nothing works. I'm starting to think this is probably impossible, but if anyone has any idea, I would greatly appreciate it!
Thanks in advance!