Are you ignoring me?
Additional gitignore settings
To round out our article about Unity and git we’re going to talk about our .gitignore file. The .gitignore file specifies which files we do not want checked in or tracked by our git repository. Files like operating specific or editor specific settings may not be useful for everyone who is using this repository. Even if you are the only person using the repository, you may work on more than one computer or setup.
Start with the standard
When I start a new repository for a Unity project I use the GitHub template for Unity .gitignore files as a starting point and then I customize and add to the git ignore file as needed. The template can be found at https://github.com/github/gitignore/blob/master/Unity.gitignore.
The settings defined in this file exclude folders like the Library folder or Build folders that are either regenerated by Unity if they are missing or every time you build the project. Other folders like Logs contain information that you just don’t want stored in your repository.
What do I add?
So some of the things I add to my .gitignore file include entries to ignore files created by my editor of choice, JetBrains Rider, as well as some setting for Visual Studio because sometimes I work with others that may not have Rider.
I also add some OS specific exclusions (in this case for MacOS)
These setting help keep settings files that may not apply to everyone working on the repo from being included.
Today's quick article covered one of the most important files you can include in a git repository. Without this file thousands of files that Unity uses but don’t need to be included in your repository will be added. If you enjoyed this article, or want to come along with me as I progress on my journey, follow me at gamedevchris.medium.com.