So I'm pretty familiar with git, but have always had a repo master that has created a .gitignore file for me, so this is my first time dealing with it by myself. My problem is that when I commit my Unity project, and pull it from a different computer, the metafiles have been ignored (I suspect), and all of the GameObjects in my scene get deleted. Here is the tutorial I followed with the gitignore file I am using.
Asked
Active
Viewed 3,734 times
1
-
Are the metafiles in the .gitignore file? If they are, should they be? – Makoto Jun 09 '15 at 01:07
-
I don't see anything that strictly says `.meta`. So I'm not sure what I'm ignoring that is including the meta files. – tommyhawk Jun 09 '15 at 01:17
-
Is there an entry ignoring the directory where they're generated? – Makoto Jun 09 '15 at 01:19
-
Keep in mind, that the unity tag if for a different kind of software. – aggsol Jun 09 '15 at 08:41
-
Did you read the comment about visible metafiles? You must have visible metafiles, otherwise git will ignore them – Mark Gossage Jun 09 '15 at 09:15
-
Ok I took the library file out of the gitignore because it had a lot of meta data in it and that seems to have fixed it. – tommyhawk Jun 09 '15 at 16:59
2 Answers
1
I have seen lots of people make these huge .gitignore
files, when really all they need to do is this:
# Ignore Everything
/*
# Except for these:
!/.gitignore
!/Assets
!/ProjectSettings
What this is doing, is:
- Ignore everything
- Then it un-ignores the rest
- The
.gitignore
file - The
Assets
folder - The
ProjectSettings
folder
- The
This should the not ignore your meta files, or anything in the Assets
folder for that matter.

Get Off My Lawn
- 34,175
- 38
- 176
- 338
-
-
I have had issues with it when I leave them out, so that is why I put them there. – Get Off My Lawn Jun 25 '15 at 20:09
-
OK, I found [this](http://stackoverflow.com/a/2476760/5044950) and [this](http://stackoverflow.com/a/6574203/5044950) that explain why they're necessary. – Sam Estep Jun 25 '15 at 20:42