网站的图像文件夹和图像是否应该存储在 SVN 存储库中?
我目前正在将所有 PHP 网站导入 SVN 存储库。每个站点都有一个图像文件夹,其中包含所有站点图像。这些图像更新非常频繁,因为其中大多数都提供图形。
图像(二进制文件)是否应该存储在存储库中?
另一个问题是它们一直在更新。您将如何频繁更新工作副本中的图像,因为您无法像编辑源文件一样在文本编辑中编辑源文件,它们需要用更新的图像替换,版本系统将如何处理此问题?
I'm currently importing all of our PHP websites into SVN repositories. Each site has a images folder which contains all the sites images. The images are updated quite frequently as most of them are offer graphics.
Should the images (binaries) be stored in the repository?
The other issue is that they are updated all the time. How would you update images frequently that are in your working copy as you can't edit the source in a text edit like you would a source file they would need to be replaced with updated images, how would the version system handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
SVN 能够处理二进制文件,包括(但不限于)图像。您可以像普通文本文件一样使用它。唯一的区别是一旦更改,它是作为一个整体更改的,而不是像普通文本文件那样作为补丁更改。
SVN is capable to handle binary files, including (but not limited to) images. You can use it like a normal text file. The only difference is once changed, it's changed as a whole, not as a patch like normal text files.
如果您想在给定时间内查看您的网站的“快照”(跟踪历史记录中的外观),那么答案是肯定的:)。
If you want to see a "SNAPSHOT" of your site in a given time (Track the appearance in history) then the answer is YES :).
我们倾向于尽量不在 SVN 中包含“内容”类型的图像(或其他二进制文件),因为我们处理的许多网站都有大量高分辨率图像和 PDF 供用户下载。对于刚刚处理代码的开发人员来说,这使得从 SVN 进行签出是一项非常漫长的任务。
一个想法是拥有两个独立的存储库;一种用于代码,一种用于“非代码”二进制文件(即一般内容)。然后为每个站点创建一个“发布”脚本,该脚本可以导出每个存储库的适当部分以创建完整的站点。这也意味着我们的内容团队可以使用内容二进制文件,而不必冒着进入代码库的风险;)
We tend to try not to include "content" type images (or other binaries) in SVN, as many of the sites we deal with have large collections of high-res images and PDFs for users to download. These make the checkout from SVN, for a developer who's just working on the code, a very long task.
One idea was to have two separate repositories; one for code and one for "non-code" binaries (i.e. general content). Then create a "release" script for each site which can export the appropriate parts of each repo to create a complete site. That also means our content team can play around with content binaries without risking them getting their sticky fingers into the code repo ;)
当您将项目定义为“网站”时,我认为您应该保留..您会知道您的整个项目位于同一个位置,版本控制,备份。您的图像也是项目的一部分。它们也经常更改或由多人工作。
SVN可以保存和版本不同类型的文件...当然对二进制文件有一些限制。但您仍然可以使用 SVN 在团队中轻松地工作。
使用挂钩脚本是将站点部署到 FTP 主机或本地计算机上的好方法。通过使用简单的提交后脚本,您可以将站点复制到测试 URL,并避免每次有人进行更改时都复制站点。
As you define your project as a "website" I think you should keep.. You'll know that your entire project is in the same place, versioned, backed up. Your images are a part of your project as well.. They also change often or worked by multiple people.
SVN can hold and version different types of files... Of course there are some limitations on binary files. But you can still enjoy hassle-free working among teams with SVN.
Using hook scripts is a good way to deploy your site on FTP hosts or on your local computer. By using a simple post-commit script you can copy your site to a test URL and avoid copying the site each time someone makes changes..