# Unity GIT - managing .meta files / Working with multiple repositories in Unity

(Original Question) → ScriptableObject has empty inspector after cloning from git

After cloning repository from git the data from the ScriptableObject asset isn't there.

An example of the problem:

A working example:

I assume the problem is in .gitignore because there is *.meta, so the data of ScriptableObject is lost. Is there a way to configure .gitignore to leave the *.meta files in some subdirectory?

• You generally do not want to ignore .meta files in your project. These are where Unity stores the UIDs that scenes/prefabs/etc. use to express references. If a new user syncs your project, or if you need to pull it down from scratch after a mishap with your working copy, all of this UID referencing information will be missing and Unity won't know what textures or materials or scripts belong on which scene objects. – DMGregory Mar 11 '18 at 14:50
• @DMGregory Right! But not generally, you might want to ignore them. For example, I have a .git repository where I store the code that I reuse all the time for different projects. So I can't put project specific data to that repository, I need this repository to have clean history and no redundant files. So when I am working on some project, I might need some feature in there and I would like to improve it and push to remote for other projects to have it too, so I must not override .meta files in different projects after pull. – Candid Moon _Max_ Mar 11 '18 at 15:06

Yes, you can ignore specific files and folders as well as make exceptions to work with 2+ repositories in same unity project without losing references on objects because of lost .meta files.
1. You can do Project/.gitignore and Project/Assets/SpecificFolder/.gitignore which will override the parent Project/.gitignore. Look tip (4) to get the opposite result
2. To exclude .meta files but save ScriptableObjects data - add *.meta and !*.asset.meta to your .gitignore which will exclude all .meta files except the ones that are .asset.meta.
3. If you have a sub-folder that is a .git repository and you want it to be added as sub-folder to remote(not as a link or submodule). You can first add some specific file from that repository folder git add Assets/my-git-repo-i-use/Controllers. Now your my-git-repo-i-use isn't anymore considered as submodule by your main .git. So you can add everything in there (4) including .meta files even if you have .gitignore that ignores *.meta.
4. If you have a sub-folder that has .gitignore with, for example, *.meta because you have the code that you reuse for every project there, but you don't want to store specific data for specific project via pushing meta files - then you can ignore the sub-folder's .gitignore from/by(haven't found a solution yet - in the parents .gitignore I have tried !Assets/my-git-repo-i-use/** - didn't work for me. I will update the asnwer, though maybe someone in the comments will have the solution to this). For now you can → 1. Just rename .gitignore in sub-folder to something like .gitignoreC to use root .gitignore rules. || 2. Create an empty folder, call it something like Archived, move sub-folder's .gitignore there.