Vipin Verma
Vipin Verma

Reputation: 5735

Single .gitignore for parent folder with multiple unity projects

I have the following .gitignore for my unity project parent folder which has multiple unity game folders inside. I have tried using git rm --cached as well but it seems like it is not stopping the tracking of library folder. The folder structure is as follows, where Car Racing, Hat trick etc, are all independent unity game folders. enter image description here

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

# Visual Studio 2015 cache directory
/.vs/

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

# Unity3D generated meta files
*.pidb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Data generated by Visage tracking
*EMOTION*.txt
/*/*-*-*-*-*-*-*.txt

Upvotes: 1

Views: 1299

Answers (1)

VonC
VonC

Reputation: 1328142

Make sure those "independent unity game folders" don't have their own .git subfolder: that would make them nested Git repo within your main parent repo, and your main .gitignore file would be ignored in those sub-repo.

You can also make sure a file is still not ignored with:

git check-ignore -v -- a/path/to/file

That being said, git rm --cached alone is not enough.

As the OP vipin8169 points out in the comments (and this answer), this is better:

 git ls-files --ignored --exclude-standard -z | \
    xargs -0 git rm --cached
 git commit -am "Remove ignored files

Upvotes: 1

Related Questions