如何让 SVN / GIT 像二进制文件一样处理文件夹?

发布于 2024-12-17 19:18:12 字数 313 浏览 3 评论 0原文

我目前正在进行一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

美男兮 2024-12-24 19:18:12

我猜想您不想提交的文件夹应该存在,但在您结帐时为空。

如果您使用 git,则必须使用 .gitignore 文件并指定您要忽略此文件夹中的每个文件,这样它们就不会被提交。
以下是 .gitignore 的内容:

*
!.gitignore

使用 SVN,您必须使用 svn:ignore 上的 propset 来忽略文件夹中的所有内容:

svn propset svn:ignore "*" path/to/your/folder

如果我错了,另一种可能性是您想使用钩子。但除非您对此答案添加评论,询问有关钩子的更多信息,否则我不应该讨论这些细节。


资源:

相关主题:

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:

*
!.gitignore

With SVN you have to use the propset on svn:ignore to ignore eveything in your folder:

svn propset svn:ignore "*" path/to/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:

我的黑色迷你裙 2024-12-24 19:18:12

在仅包含以下行的文件夹中创建 .gitignore 文件:

 !.gitignore

这告诉 git 忽略该文件夹中的所有文件,除了 .gitignore 文件本身。

这样,它会创建文件夹,但不会尝试管理缓存的资源。

Make a .gitignore file in the folder containing just the line:

 !.gitignore

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.

天煞孤星 2024-12-24 19:18:12

确保您在“编辑 > 编辑器 > 版本控制”下选择了“元”。这样,您就可以忽略 Temp 目录和 Library 目录,并避免完全对它们进行版本控制:)

只需版本 AssetsProjectSettings.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 the Library dir, and avoid versioning them altogether :)

Just version Assets and ProjectSettings, 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文