PSA, Global Git Ignore

Hey everyone, I wanted to give you all a quick PSA regarding the .gitignore file.

A quick explanation for those who don’t yet know what a .gitignore file is, the .gitignore file is a file that defines what files git should not see as changed when you’re about to commit something. There is currently a generic Unity .gitignore file in the project which ensures that the library, obj, logs and other data that isn’t required for the project to be re-build will not be added to git. This both helps keep the git history clean and avoids the project from getting too big to host.

Since we’re most likely using many different IDEs to write code for the project you might think that it would be a good idea to add any files specific to your IDE that it generates in the project folder to this general .gitignore, the problem with that is that this file would then grow quite big in order to support all the different IDEs that may exist which isn’t really a clean approach. Instead you can create a local global .gitignore file, this would ensure that your IDE specific files don’t get pushed to any repo on that machine anymore and keep the shared .gitignore cleaner for everyone else.

You can find a guide on how to achieve this here, Global gitignore · GitHub

Myself I use Jetbrains Rider and thus my global gitignore is simply this

.idea/

And after this change I no longer have to watch out for accidentally adding the .idea folder in my commits without having to alter the gitignore of the project. To know exactly which files to ignore for your IDE you can simply find it on Google. Hope it helps!

3 Likes

Anyway, it would be cool to have in .gitignore most common IDEs: VS Code, Visual Studio, Rider.

Rider gang:sunglasses:

2 Likes

And… I can’t find anything related to Git LFS. That’s weird…

In what sense? We’re not using LFS on this repository.

But why? This is a game project with binary assets like models and textures and LFS created exactly for such things.
Just curious:)

LFS is sometimes hard to setup on the end user’s machine, and can lead to mistakes that are hard to fix.
Plus, monthly bandwidth on Github is limited, and we would consume it pretty quickly.

The “low-fidelity” of this game (for instance textures should be relatively light) should allow us not to go over 100MB per asset, which is the limit for non-LFS Git. Hopefully we won’t go overboard with scene size.

1 Like

There is a git repo with kind of default gitignore files.
Thought it would help.
https://github.com/github/gitignore

See also the community and Global sub directories if you do not find what you are looking for in the root.

1 Like