本文介绍了非文本文件/大型项目的Git vs SVN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几周我一直在学习Git,我真的很喜欢它与SVN相比的工作方式。我期望完全切换到它的主要原因是,合并在很少的冲突和我可以在本地提交的事实上要容易得多。这促进了许多分支机构的使用(如每个机票/问题/任务等的分支机构),并促进了许多提交。我只使用分支,如果我需要在SVN(因为合并经常产生冲突),我只在100%确定问题得到解决时才提交(而不是增量提交,这将更好)。

现在,我一直在阅读的关于git的一个问题是关于非文本文件/大型项目。例如,我正在研究当前由SVN控制的游戏项目。现在有一个游戏项目,会有很多非文本文件,比如艺术,声音和其他二进制文件,其中一些文件可能会变得很大。 git如何处理非文本文件/大二进制文件?如果我想将这样一个项目移植到git中,我需要记住的一些注意事项是什么?

其中一个解决方案 Git存储数据与其他版本控制系统相比存在的巨大差异在于Git将文件内容完全存储为单个对象。这意味着每个文件的每个版本都作为存储库中的完整文件存在(尽管它非常压缩)。因此,当其他VCS存储两个版本之间的差异/差异,并且因此以不同方式处理二进制文件和文本文件(因为二进制文件不是那么难分辨的),Git只是将它们全部处理成相同。



因此,在Git中使用二进制文件与使用任何其他文件类型没有什么不同。您只需要记住,版本控制非常大的文件会增加您的存储库大小(因为即使实际的二进制更改很小,该大型文件的每个版本都会保存原样)。然而,Git的压缩功能可以创造奇迹,并且通常不会引起您的注意。特别是如果你只是在谈论一个项目的资产,你可能不会遇到任何困难。

I have been learning Git the past weeks or so and I really like the way it works in comparison to SVN. The main reason I am looking to fully switch to it is the fact that merging is supposedly a lot easier with few conflicts and the fact I can commit locally. This promotes the use of many branches (like a branch per ticket/issue/task/etc..) and also promote many commits. I only use branches if I need to in SVN (since merges often produces conflicts) and I only commit when I am 100% sure the issue is fix (instead of incremental commits, which would be nicer).

Now, one concern I have about git as I have been reading it is about non text files/large projects. For example I am working on a game project currently controlled in SVN. Now with a game project, there are going to be a lot of non text files like art, sound, and other binary files and some of the files can get pretty big. How well does git handle non text file / large binary files? What are some of the considerations I have to keep in mind if I want to port over such a project to git?

解决方案

One of the big differences in how Git stores data compared to other version control systems is that Git stores the file content completely as a single object. That means that every version of every file exists as a complete file in your repository (it's very compressed though). So while other VCS store the differences/deltas between two versions, and as such handles binary and text files differently (as binary files are not that diff-able), Git just handles all of them identical.

As such, working with binary files in Git is not different to using any other file type. You just need to keep in mind that versioning very large files is going to increase your repository size a lot (as every single version of that large file is stored as it is, even if the actual, binary change was small). Git's compression however works wonders and makes you not notice this usually. Especially if you are only talking about a program's assets, you probably won't have any difficulties.

这篇关于非文本文件/大型项目的Git vs SVN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 05:45