different unity projects in one repo and want gitignore to ignore all high size volume folders

I have a folder where I keep all my different games and each game has its own "Assets", "Library", "Logs" etc. folders.

Before, when I wanted to just upload only 1 project to GitHub, I chose .gitignore Unity and it automatically ignored those giant files which was unnecessary to upload.

Right now I have multiple projects in 1 folder and I want to upload them all in 1 repository and also, I want my .gitignore to ignore all unnecessary files in each directory like the way it used to do for only 1 Unity game.

My .gitigonore right now is this:


# Visual Studio cache directory .vs/

# Autogenerated VS/MD/Consulo solution and project files ExportedObj/ .consulo/

# Unity3D generated meta files

# Unity3D Generated File On Crash Reports sysinfo.txt

# Builds

What should I change in order to fulfill what I want to happen?

BTW I'm new to git and I'm pretty sure there is a very simple answer for my problem.

However I couldn't find it on internet!

1 answer

  • answered 2021-06-10 11:42 derHugo

    Option A - SubModules

    You could look into SubModules and have one repository like

    • Main Repository
      • App 1 - SubModule
      • App 2 - SubModule

    Each SubModule would bring its very own .gitignore that applies to its according root folder.

    This makes most sense if you have one main application and then multiple actual modules of functionality you are all using in that main application.

    Option B - ** path wildcard

    Just adjust the .gitignore to ignore any folders with according names like


    see .gitignore Documentation

    Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

    • A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under a directory "foo".

    This makes most sense in a case where you are e.g. working a larger project that actually simply includes different Unity projects that are completely independent.

    Careful though: If you now would have a folder like Assets/Models/Obj/... this folder would be ignored ;)

    To avoid such case you can then again not ignore folders if they are within the Assets folder(s) like