如何让 SVN / GIT 像二进制文件一样处理文件夹?
我目前正在进行一个 Unity 项目,其中有一个文件夹我们无法提交,因为它包含经常更改的缓存数据,但对于应用程序的运行是必需的,并且最后一个版本必须
当前,我们必须压缩文件夹,然后提交 zip。这显然很耗时。
有没有办法让 SVN 或 GIT “认为”文件夹就像是二进制文件一样?具体来说,它会忽略该文件夹内的单个文件树,而是将其作为一个块进行处理。
这可能吗?是否有其他版本控制解决方案可以做到这一点?谢谢。
(我原本打算编写一个 BAT 文件来自动执行压缩和解压缩,但由于 Windows 7 的板载压缩实用程序无法从命令行访问......)
I'm currently on a Unity project where there is a certain folder we can't commit, because it contains cached data that changes frequently, but is necessary for the application to run, and the last version must
Currently, we have to zip the folder, and commit the zip. This is obviously time-consuming.
Is there a way to make SVN or GIT "think" of a folder as if it were a binary file? Specifically, it would ignore the individual file tree inside that folder, instead processing it as one single chunk.
Is this possible? Is there another version control solution which can do this? Thanks.
(I was originally going to write a BAT file which would automatically do the zip and unzip, but seeing as Windows 7's onboard zipping utility is inaccessible from the command line...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我猜想您不想提交的文件夹应该存在,但在您结帐时为空。
如果您使用 git,则必须使用
.gitignore
文件并指定您要忽略此文件夹中的每个文件,这样它们就不会被提交。以下是
.gitignore
的内容:使用 SVN,您必须使用
svn:ignore
上的propset
来忽略文件夹中的所有内容:如果我错了,另一种可能性是您想使用钩子。但除非您对此答案添加评论,询问有关钩子的更多信息,否则我不应该讨论这些细节。
资源:
相关主题:
I will guess that the folder you don't want to commit should be present but empty when you checkout.
If you're working with git you have to use the
.gitignore
file and specify that you want to ignore every file in this folder, this way they won't be commited.Here is the content of
.gitignore
:With SVN you have to use the
propset
onsvn:ignore
to ignore eveything in your folder:If I'm wrong the other possibility is that you want to work with hooks. But unless you add a comment to this answer, asking for more information on hooks, I should not get into those details.
Resources:
Related topics:
在仅包含以下行的文件夹中创建 .gitignore 文件:
这告诉 git 忽略该文件夹中的所有文件,除了 .gitignore 文件本身。
这样,它会创建文件夹,但不会尝试管理缓存的资源。
Make a .gitignore file in the folder containing just the line:
This tells git to ignore all the files in the folder, except the .gitignore file itself.
This way, it creates the folder but doesn't attempt to manage your cached resources.
确保您在“编辑 > 编辑器 > 版本控制”下选择了“元”。这样,您就可以忽略
Temp
目录和Library
目录,并避免完全对它们进行版本控制:)只需版本
Assets
和ProjectSettings
和.gitignore
。另外,您是否尝试过使用 Unity Asset Store 中的 Git UniTEAM?它是一个编辑器扩展,可让您管理 Git 版本化项目。
Make sure you have "Meta" selected underneath "Edit > Editor > Version Control". This way, you can ignore the
Temp
dir, and theLibrary
dir, and avoid versioning them altogether :)Just version
Assets
andProjectSettings
, and.gitignore
.Also, have you tried using Git UniTEAM from the Unity Asset Store? It's an editor extension that lets you manage your Git versioned project.