涉及二进制文件和文本文件时的版本控制?
我有一个项目需要维护对文本和二进制文件的更改。我有几个选择:
- 使用补丁
- 使用 git 或 hg 等版本控制系统。
就我的目的而言,如果补丁只是文本文件,那么补丁是更好的选择。但是,由于有些图像可能会被替换/添加/删除,那么最好的方法是什么?
是否有一个干净的 diff/patch 实用程序也可以处理二进制差异(无需我指定它是二进制的 - 我应该能够比较整个目录而不是单个文件,但我不能与二进制模式下的 bash 差异)并将它们用作补丁? 如果不是,对于二进制文件来说,哪种版本控制系统是更干净的选择?
I have a project where I need to maintain changes to both the text and binary files. I have a couple of options:
- Use patches
- Use a versioning system like git or hg.
For my purposes, patches are a better option if it was only text files. However, since there are images that might be replaced/added/deleted, which is the best way to go?
Is there a clean diff/patch utility that can take care of binary differences as well (without me having to specify it is binary -- I should be able to diff the entire directory and not individual files, which I can't with bash's diff in binary mode) and use them as patches? If not, which versioning system is a cleaner option when it comes to binary files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Mercurial 有补丁队列的概念(启用了 mq 扩展),很大程度上受到 quilt 的启发.
这允许您以多种方式管理补丁:
作为奖励,由于补丁队列实际上是补丁文件,因此您可以轻松更改它们的顺序,甚至将它们从一个队列移动/复制到另一个队列(查看 .hg 目录以查找补丁队列)。
您可以在 Steve Losh 关于 Mercurial 队列的教程。
Mercurial has the notion of patch queue (with the mq extension enabled), largely inspired by quilt.
This allows you to manage your patches in several ways:
As a bonus, as patches queues are really patch files, you can easily change their order and even move/copy them from one queue to another (have a look in your .hg directory to find the patch queues).
You can find a lot more of usefull information about managing patch queues at Steve Losh's tutorial on mercurial queue.
Git 和 Mercurial 都可以轻松处理文本和二进制文件。使用您喜欢的任何一个。是的,VCS 是正确的选择。
Both Git and Mercurial can easily handle both text and binary files. Use whichever you prefer. And yes, a VCS is the right choice.
如果您不喜欢这样的 VCS,请尝试使用包含补丁的 ftp 服务器。版本号可以用作目录名称。该系统可以通过脚本进行支持,该脚本根据目录名称顺序应用补丁。
在我正在进行的项目中,数据库补丁就是以这种方式应用的。然而,它们是在 VCS 内维护的。文件可用于维护当前版本,脚本将读取该文件来决定应用哪个补丁。
If you don't like a VCS as such, try using a ftp server containing patches. Version numbers can be used as directory names. This system can be backed with a script, which applies patches sequentially based on directory names.
In the project I'm working on, database patches are applied in this manner. However, they are maintained inside a VCS. A file can be used to maintain the current version, which will be read by the script to decide which patch to apply.