Reputation: 225
I'm new to the idea of a .Gitignore but I understand that it tells git to ignore certain files in the commit process, why would you want to ignore any Unity file in a Unity project?
Upvotes: 4
Views: 3895
Reputation: 134
To my knowledge the only thing you actually need to commit to your repo is your assets directory, the rest can be ignored. The reason for this is to save space in the repo and not get merge conflicts when attempting to merge branches.
An example of a standard unity .gitignore on github can be found here: https://github.com/github/gitignore/blob/master/Unity.gitignore
Upvotes: 1
Reputation: 21908
To brush it very broadly, most of the times for big IDE projects the idea* is not to version generated files, since they tend to change frequently if not all the time, and merging/diffing them usually makes no sense.
You version your source code, and you build from it, generating whatever artifacts you need for your application to run, outside of source control.
Unity files seem to fall into this category. You can find sources on the web, there are different guides to use git efficiently in Unity projects. This is one, updated recently. And a search here on SO on appropriate tags is quite fruitful. Don't hesitate to compare different settings to choose what best suits your specific context.
Also, on GitHub you have this (thanks to derHugo for the link) :
https://github.com/github/gitignore/blob/master/Unity.gitignore
Also useful, added after comments :
.gitignore official doc (all the page is a useful read, but pay special attention to "pattern formats" to tweak your own patterns)
a useful tool to test your patterns : git check-ignore <path>
* (pun not intended)
Upvotes: 10