.gitignore repo

Does anyone know what we can safely ignore when creating a version control using Git?

This is from the Unity .gitIgnore setting used by GitKraken;

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/

# Autogenerated VS/MD solution and project files
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj

# Unity3D generated meta files
*.pidb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

You can obviously add more to it / tweak it as you wish.

1 Like

This is mine that I use on GitHub and the Github desktop app. Github is aware of unity and this is its default .gitignore

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*

# Autogenerated VS/MD solution and project files
ExportedObj/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd


# Unity3D generated meta files
# *.pidb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

Just a quick note on Git and Unity

It may be worth mentioning that I had a bit of a learning curve with Unity and Git. Do not use empty folder/directories in your project as they will be ignored by Git and not saved by default. It can leave Unity with a .meta file but not corresponding folder. Things then start getting messy! If I really want to have a empty folder in Unity, to help visualise my project structure etc, I just create an empty dummy.cs file it it which gets around this problem. I’m not sure what my mate and mentor Rob does :wink:

Cheers

Paul

1 Like

I’m not sure what my mate and mentor Rob does

*chuckle* :slight_smile:

Oooh… don’t make me get all housekeepingy on ya! I personally don’t have empty folders or anything I don’t need in my project(s), this ensures that my CDO monster stays at bay! :wink:

I only noticed a couple of differences between ours so I went off to have a Google, in the process I stumbled across this;

https://github.com/github/gitignore/blob/master/Unity.gitignore - might be useful

I think it’s possible that some of the entries may never be used anyway, but it really will come down to how each individual (or member of the team) works… for example, on that GitHub link I pasted above it also covers *.apk, when ever I build I tend to choose a completely separate path for the build anyway, so potentially I shouldn’t ever end up with a *.apk in the working directory…

Note *coughs* shouldn’t *coughs*

You could argue, if you aren’t using MonoDevlop, you wouldn’t need the *.pidb files either;

http://stackoverflow.com/questions/1022111/what-are-monodevelops-pidb-files

If you were to hit build within Visual Studio you will invariably get a /bin directory and also .pdb files

https://msdn.microsoft.com/en-us/library/ms241613.aspx

…and on it goes! :slight_smile:

I suspect most people will have a very similar set of core ignore entries and then there will be a few others bolted on to cover other specifics which may not apply to you or, may not apply to you yet depending what you are working on.

If you keep an eye on your own repos and see what is actually going into them it will help identify anything else that you want to exclude.

1 Like

@Tim_Neufeld Hi Tim, I mostly use this website which generates gitignore files for many types of development environments like Unity etc.

2 Likes

Privacy & Terms