Unity creates and deletes meta files for folders inside the Asset folder.
That can create an annoying situation when using version control (that you can skip and go to the questions): someone creates a folder of files that will be ignored but forget to ignore the folder's meta file. Unity creates the meta file and the person adds the meta to version control. Another person gets the changesets and, since he doesn't have the folder, his Unity delete the meta file and he removes the meta file from version control. Not everyone in the team understand this, so the process is perpetuated in a loop from hell.
Surprisingly this happens all the time. So, two questions:
- Is it important to version folder meta files?
- Is there a way to automatically ignore folder meta files - particularly on git or mercurial?
The Unity docs say:
For me this is reason enough to put them under version control. I see two approaches to solve the problem:
I just played around with the different git commands, the following could be useful: The git hook script shoud first check if .gitignore has changed by:
Print out directory names of all newly added lines in .gitignore if they are located under the Assets folder:
Update
I just wrote such a pre-commit hook :-) See the GitHub repository git-pre-commit-hook-unity-assets for code and my blog posting about it for more details.
to include meta files along with assets, simply add the following after your exclusions:
Here is a sample of my .gitignore:
I place this at the folder with the git repository structure, so my project structure would look similar to:
hope that helps.