文件纹理与线条纹理版本控制系统 [英] file grained vs line grained version control systems

查看:141
本文介绍了文件纹理与线条纹理版本控制系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么样的文件和文件行版本控制系统的例子?根据我的理解,一个在文件上工作的控制系统能够在没有文件冲突时自动管理合并:

例如:

  A,B,C  - > A',B',C 
| (分支)___________(合并) - > A',B',C'
-------> A,B,C'

在哪些情况下,在线工作的版本控制系统能够管理自己合并,并在其他情况下要求开发人员解决这些问题?

解决方案

您的问题太宽泛/一般,但我会尽力给您一个镜头。 b

现代版本控制系统中的大多数合并策略都无法处理以下内容:

假设您的文件 A B C 在提交 001 在存储库中。
开发者 Dev1 提交的分支 001 并更改一行文件 A ,提交为 001a

开发者 Dev2 提交分支 001 ,并更改文件 A 中的同一行,并提交为 001b



如果有人想合并提交 001a 001b ,合并系统无法分辨哪一行是正确的更改,也许项目的正确更改将使用commit 001a 或者可能是提交 001b 中的一个,或者甚至这两个变化混合在一起(有人可能需要创建)。

这通常是您如何得到需要手动干预的冲突,因为两名开发人员正在相同的文件和行,并写了不同的更改。



在其他情况下,结果是显而易见的:


  • 任一提交都没有更改?合并结果中没有更改。

  • 任一提交中的更改?
  • 更改同一个文件,但不同的行(例如,两个开发人员使用不同的方法)?这两个更改都在合并中应用。


  • What are some examples of version control systems that work on files and on lines of files?

    In my understanding, a control system that works on file is able to automatically manage merges whenever there are no file conflicts:

    for example:

    A,B,C --> A',B',C
    | (branch)  ___________ (merge) -> A',B',C'  
     -------> A,B,C'  
    

    In what cases a version control system that work on lines is able to manage merge by itself and in what other cases it asks the developer to solve them?

    解决方案

    Your questions is too broad/generic but I'll try to give a shot anyways.

    Most merge strategies in modern Version Control Systems, can't deal with the following:

    Suppose you have files A B C in commit 001 in a repository.
    Developer Dev1 branch of commit 001 and changes one line in file A, commits as 001a.
    Developer Dev2 branch of commit 001 and changes the same line in file A and commits as 001b.

    If someone wants to merge commits 001a and 001b, the merge system wouldn't be able to tell which is the correct change for the line, maybe the correct change for the project would be using the content in commit 001a or maybe the one in commit 001b, or maybe even mix of both changes in the line (that someone would have to create).

    That's usually how you get a conflict that need manual intervention, because two developers are working in the same file and line and wrote different changes.

    In the rest of the cases the result is obvious:

    • No changes in either commit? No changes in the merge result.
    • Changes in either of the commits? The change is applied in the merge.
    • Changes in the same file but different lines (for example, two devs working in different methods)? Both changes are applied in the merge.

    这篇关于文件纹理与线条纹理版本控制系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆