Using git to track only some of a Unity project

微笑、不失礼 提交于 2019-12-08 14:03:49

问题


I've been using git to work on a Unity project, but I've found I don't really want to check the the whole project into source control all the time. I have a bunch of plugins downloaded that I expect to delete later and I don't want to bring them into my git history.

Are there any files in Unity that I need to keep checked in or am ok to just version the stuff I'm working on. I'm still getting the hang of git so this may be as much about version control best practices as it is about Unity. For example, does it matter if I check in my Scene files or is there any reason they might get out of sync if I don't.

I feel like just checking in the files I want is the correct approach, I just want to make sure I'm not going to cause myself problems later.

For example, in the Assets folder i have:

downloadedLibrary1/
bunchOfTestScenes/
scriptsIwantToKeep/

If I use git to only watch the scriptsIWantToKeep/ folder is that going to cause me problems now or down the road or is that the correct way I should be using git in the first place?


回答1:


You can use a sparse checkout to pull only the folders you want, if you declare them in a .git/info/sparse-checkout file.

There can be some issue with subsequent git pull (as shown in this 2012 question), but if you are using a recent 1.9.x version of git, updates of a sparse checkout should work just fine.

You can then "watch" those specific folders by doing regultar git pull, and git log -- aFolderYourWatch, in order to see the history of commits impacting those specific folders.



来源:https://stackoverflow.com/questions/23705337/using-git-to-track-only-some-of-a-unity-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!