- Home /
Ignoring folder meta files on version control
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?
Good question. I had a similar situation for different reasons. I sometimes end up with empty folders, and since git does not take them in, I end up with meta files but no folders in the repo, so Unity complains and deletes them, and then I am in the loop from hell.
As far as I can tell, folder meta files have little use
I do not think there is a straight forward way to gitignore folder meta files, as they are just *.meta files like any other. So the only way would probably be to run an external script before committing.
I would recommend NOT ignoring them, and ins$$anonymous$$d, apply a policy in your $$anonymous$$m's workflow that states they should put content to be ignored inside folders that start with _ (or some other symbol) and then you have a global gitignore for that (which will ignore the folder and its meta).
Answer by roberto_sc · Oct 29, 2013 at 07:19 AM
I made the same question on StackOverflow and got a very good answer that you can check here.
Answer by Lieene-Guo · Aug 30, 2019 at 02:38 PM
Add this to .getignore
#Ignore all .meta file
*.meta
#But not source file with postfix. which is everything but a folder
!*.*.meta
This will ignore file without postfix. But that shouldn't hurt.
Hey, do you know how that work in conjunction with the default lines in the gitignore: # Never ignore Asset meta data (What is this? came with the default) !/[Aa]ssets/**/*.meta
should the above lines be removed then since it seems contradictory?
Your answer
![](https://koobas.hobune.stream/wayback/20220613115228im_/https://answers.unity.com/themes/thub/images/avi.jpg)