使用git只跟踪一些Unity项目 [英] Using git to track only some of a Unity project

查看:157
本文介绍了使用git只跟踪一些Unity项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用git来处理一个Unity项目,但是我发现我并不是真的想要一直检查整个项目到源代码控制中。我有一堆下载的插件,我希望稍后删除,我不想将它们带入我的git历史记录中。

Unity中是否有任何文件需要保持检入状态,或者确定版本正在工作。我仍然得到git的支持,所以这可能与版本控制最佳实践相同,因为它与Unity有关。例如,如果我检查我的场景文件,或者如果我没有任何原因,他们可能会失去同步,这会影响吗?



我觉得只是检查我想要的文件是正确的方法,我只是想确保以后不会导致自己的问题。



例如,在Assets文件夹中我有:

  downloadedLibrary1 / 
bunchOfTestScenes /
scriptsIwantToKeep /

如果我使用git来只看scriptsIWantToKeep /文件夹是否会导致我现在或未来的问题,或者是我应该首先使用git的正确方法?

解决方案

您可以使用 稀疏结帐 ,只需将所需的文件夹放入中即可。 git / info / sparse-checkout file。



随后的git pull可能会出现一些问题(如2012问题),但如果您使用的是最新的1.9.x版本的git,那么稀疏结帐的更新应该可以正常工作。



然后,您可以通过执行regultar git pull 和git log - - aFolderYourWatch ,以便查看影响这些特定文件夹的提交历史记录。


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?

解决方案

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.

这篇关于使用git只跟踪一些Unity项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆