Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is a .gitignore needed for unity projects on Github?

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?

like image 815
Ultra Gamer Avatar asked Dec 18 '22 17:12

Ultra Gamer


1 Answers

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)

like image 132
Romain Valeri Avatar answered Dec 31 '22 13:12

Romain Valeri