Awesome .gitignore & .gitattributes

Hi folks,

I have posted this before on an older course (V1 of the complete unity dev course), but thought I would repost as there is a dedicated lesson for this now.

I created a fully inclusive .gitignore and .gitattributes file for use with Unity, though it also includes a number of entries for Visual Studio & mac specific elements too.

The .gitignore will keep anything out that you don’t need in your project, as explained in the video.
The .gitattributes will setup specific rules for how to treat files, (to prevent corruption in binary files etc.), and also adds a few rules so if you go to view the files on Github/Bitbucket etc, will stop you having to scroll for a week just to get past 1 file :slight_smile:

Feel free to use them, and if you spot anything else you think would be good, just let me know.

Usage, well, once you initialise your git repo, just drop them in the root :slight_smile:

Git Setup for Unity - Gist

1 Like

Cool, thanks!

Personally, I’m not a fan of excluding either of the following.
*.apk
*.unitypackage

I see these a lot in unity .gitignore files, but there are legitimate reasons to keep both of these.

One of the more popular reasons for APKs is the AR Core SDK. It includes an APK for instant preview.
Many asset store packages will include .unitypackage files for a variety of optional add-ons. Since you can’t download an old version of an asset from the asset store, making sure you can easily get the correct version unitypackage in the future is pretty important.

Great starting point for 99% of use cases though!

Privacy & Terms