Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity Git - Ignore Library

We have been trying to setup Git with Unity past two days on our project between Mac and Pc. We got it kinda working, but we still have issues with the metadata and conflicts in Library/AssetDatabase3.

We got the whole Library folder in the .gitignore file but for some reason it seems some files in it are not ignored.

We will also get during commits huge list of metadata instead of only seeing changes on files which actually changed, there will be list of hundreds of metadata. Again coming from Library.

Any idea why Library folder doesn't get full ignored with ignore file? The issue with conflicts seems to be coming from assetDabase file. Any suggestions for good workflow between Mac and Pc?

like image 885
CosmicSeizure Avatar asked Sep 25 '15 13:09

CosmicSeizure


2 Answers

I recently had this happen to me and found that the issue was that I had my entire Unity project in a folder in the repo, and the gitignore was using the syntax of

/[Ll]ibrary/

which only searches folders at the same level as the gitignore itself, whereas

[Ll]ibrary/

without the leading / searches all subfolders as well. Removing the leading / led it to properly ignore the Library. Hope this helps!

EDIT: It should be noted that this solution will also cause it to ignore any other folders named Library, if you happen to be using that name elsewhere for some reason.

like image 183
Daimee MacIsaac Avatar answered Sep 28 '22 06:09

Daimee MacIsaac


Even after you have added the files to your gitignore, Git may still know about the files you added.

Try committing your actual changes and then running the following command.

git rm -r --cached .
git add .
git commit -m "fixed untracked files"
like image 33
Ajanthan Hariharan Avatar answered Sep 28 '22 07:09

Ajanthan Hariharan