简体   繁体   English

分散式版本控制系统如何改善工作流程?

[英]How does a decentralised version control system improve workflow?

I have really tried to understand how distributed version control systems alter the way we work. 我真的试图了解分布式版本控制系统如何改变我们的工作方式。 I watched a tech talk of Linus Torvalds on git , which is mostly about the power of distributed version control, and he claims that it alters the way in which we work. 在git上观看了关于Linus Torvalds的技术演讲,主要是关于分布式版本控制的强大功能,他声称它改变了我们的工作方式。

Let's consider git. 我们考虑一下git。 There are plenty of good reasons to love and use git, I am aware of these good reasons. 爱和使用git有很多充分的理由,我知道这些充分的理由。 I am also certain that the power of the decentralised model doesn't extend to just efficiency and the ability to make local commits. 我也确信分散模型的强大功能并不仅限于提高效率和进行本地提交的能力。 One of the important points is that it allows developers to synchronise their work. 其中一个重点是它允许开发人员同步他们的工作。 Assuming that the work has not been commited already, I would presume the code to be (potentially) unsuitable for deployment, possibly subject to change (bad if I am hard coupling my dependencies to it), which to me sounds like a world of pain waiting to unfold. 假设工作尚未提交,我会假设代码(可能)不适合部署,可能会发生变化(如果我很难将我的依赖项与它联系起来那么糟糕),这听起来像是一个痛苦的世界等待展开。

I have a feeling that the decentralised model works brilliantly in the setup that Linus faces, but this is typically uncommon of most setups or needs, and that a centralised setup is essentially what we all want and use within our unified networks (ie the majority of company setups, though I admit this is an assumption on my part). 我有一种感觉,分散模型在Linus面临的设置中运行得非常出色,但这通常不是大多数设置或需求,并且集中式设置本质上是我们在统一网络中所需要和使用的(即大多数公司设置,虽然我承认这是我的假设)。 We all push stuff back to a central location so we can share it with others, and this need for centralisation forms the basis of github. 我们都将东西推回到中心位置,以便我们可以与其他人分享,这种集中化的需求构成了github的基础。 We all rely on the integrity of the central location to provide secure access to our work and to back it up for us as well. 我们都依靠中心位置的完整性来提供对我们工作的安全访问,并为我们提供支持。

Don't regress into answering why git is lovely. 不要回答为什么git很可爱。 It works brilliantly in a centralised model with the bonus of local commits, but I really feel like I have missed the point about decentralised workflows somewhere.... I may have to watch the video again 它在集中模型中出色地工作,并且有本地提交的奖励,但我真的觉得我已经错过了关于分散工作流程的地方....我可能不得不再次观看视频

Update: 更新:

Thanks for engaging the question, I don't think I made my point particularly obvious. 感谢您提出这个问题,我认为我的观点并不是特别明显。 Basically the issue I face is as follows. 基本上我面临的问题如下。 Many companies are setup with a central workflow. 许多公司都设有中央工作流程。 We work on a unified fast local network. 我们致力于统一的快速本地网络。 Managing the logistics of a centrally managed configuration are somewhat simpler; 管理集中管理配置的后勤工作稍微简单一些; we all use the central repository, this is the honey pot we make sure to safeguard against disk failures and fires and anything else you might be paranoid about. 我们都使用中央存储库,这是蜂蜜罐,我们确保防止磁盘故障和火灾以及你可能会偏执的任何其他事情。 Factoring this necessity into your workflow increases the chances that your work, regardless of state, ends up in this safe location. 将这种必要性考虑在您的工作流程中会增加您的工作(无论状态如何)最终进入这个安全位置的机会。 We rely on the network connectivity and availability of this central location for just about everything we share. 我们依靠这个中心位置的网络连接和可用性来处理我们共享的所有内容。 I first thought that maybe that our love for the central workflow is just our inability to grasp how to use DVCS on the micro scale. 我首先想到的是,我们对中央工作流程的热爱可能就是我们无法掌握如何在微观尺度上使用DVCS。 Now to say just use git because it's a superset of the centralised variant is ok I guess. 现在说只是使用git,因为它是集中式变体的超集,我猜是好的。 However given that I still, in the majority of cases, can't see anything that is intrinsic to the decentralised model, we might be using a more complicated tool to solve a simpler problem. 然而,鉴于我仍然在大多数情况下看不到分散模型固有的任何东西,我们可能会使用更复杂的工具来解决更简单的问题。 There may be some value in a centralised tool that does what we are already doing. 集中式工具可能有一些价值,可以完成我们已经在做的事情。

Git improves workflow because merges are no longer painful things to do. Git改进了工作流程,因为合并不再是痛苦的事情。

If you've ever worked with several developers on a single project using a SCM, you should know that merging is THE #1 issue you have to deal with. 如果您曾经使用SCM与单个项目的多个开发人员合作,您应该知道合并是您必须处理的第一个问题。 Assuming you watched the video, you already know that Linus went to some lengths to elaborate on that issue, and why that is the main issue with other SCMs. 假设您观看了视频,您已经知道Linus需要花一些时间来详细说明这个问题,以及为什么这是其他SCM的主要问题。

I'm going to be restating the example Linus made in the video you said you watched, but here goes: 我将重述Linus在你说你看过的视频中所做的例子,但是这里有:

Say there are 3 developers, including yourself, working on a project that has 3 parts. 假设有3个开发人员,包括你自己,正在开发一个有3个部分的项目。 You are all experts in respect to the parts you're working on. 您是所有工作方面的专家。 Assuming you've been designated the maintainer of the repository, the other two developers may ask you to merge code into the main branch. 假设您已被指定为存储库的维护者,则另外两个开发人员可能会要求您将代码合并到主分支中。 BUT! 但! You're not an expert on what they worked on, and you don't necessarily need to understand how their code works... but you trust that the changes they've made are OK. 你不是他们工作的专家,你不一定需要了解他们的代码如何工作......但你相信他们所做的改变是可以的。 With git, you can shift the responsibility (read: work) of merging to them. 使用git,您可以将合并的责任(读取:工作)转移到它们。 Once they've pulled your code, merged theirs into it, and committed it, they can ask you to pull the merged code. 一旦他们提取了代码,将他们的代码合并到代码中并提交了代码,他们就会要求您提取合并后的代码。

Why is this good? 为什么这样好? Because they did all the work, and they understood what they were merging. 因为他们完成了所有的工作,他们理解他们正在合并的东西。 Without git, this process would undoubtedly be very painful and time consuming. 没有git,这个过程无疑会非常痛苦和耗时。

DVCS allows you to do stuff without affecting other people's work until it is ready to. DVCS允许您在不影响其他人工作的情况下完成工作,直到准备就绪为止。

So you can fix all your mistakes and integration incompatibilities locally, then send it out. 因此,您可以在本地修复所有错误和集成不兼容性, 然后将其发送出去。

I'll try to answer on asked question 我会尝试回答问题

Sort version 排序版本

Any DVCS does NOT improve workflow by itself. 任何DVCS本身都不能改善工作流程。 So on question "How?" 所以问题“怎么样?” fast&simple answer is "In no way!" 快速而简单的回答是“绝不!”

Longer version 更长的版本

DVCSes have possibilities (due to distributed nature), which can be used to change and evolution workflow and common style of work. DVCS 有可能 (由于分布式性质),可用于改变和演变工作流程和共同的工作方式。 But it's always not technical , but managerial, administrative and organizational solution and responsibility: what, how, when, to solve which business-tasks using DVCS is possible and justified. 但它始终不是技术 ,而是管理,行政和组织的解决方案和责任: 什么,如何,何时,解决使用DVCS的哪些业务任务是可能的和合理的。

Immediately at the start I can see one big business advantage of DVCS - it allow P2P communication between developers, decreasing this way wasted in CVCS mode time. 在开始的时候,我可以看到DVCS的一大业务优势 - 它允许开发人员之间的P2P通信,减少这种方式浪费在CVCS模式时间。

Where it can be useful and requested? 哪里有用和要求? Any time, when 2+ developers work on related, but isolated from "mainstream" task. 任何时候,当2个以上的开发人员从事相关工作,但与“主流”任务相隔离时。 Imagine 想像

  • some system with core and frontend and separated responsibility areas (coredev doesn't touch frontend, frontman can't do any with core) 一些系统具有核心和前端以及分离的责任区域(coredev不触及前端,主管不能用核心做任何事)
  • one repo for core and front, without external repos (all-in-one) 核心和前端的一个回购,没有外部回购(一体机)
  • small job in front require core changes 前面的小工作需要核心变化
  • front-file is in /views/default/main/lib.js, core-file /core/db/connectors/engine (but locations deep haven't real value in our example) 前端文件位于/views/default/main/lib.js,core-file / core / db / connectors / engine(但在我们的示例中,深度位置没有实际价值)

SVN-version, branch-per-operation mode SVN版本,每操作分支模式

  • Frontman works with WC, related to branch "branches/lib2-frontend" ( not sparse copy), when "shit happens" Frontman与WC合作,与分支“branches / lib2-frontend”( 非稀疏副本)相关,当“狗屎发生”时
  • Coredev create branch "branches/lib2-fixes", successfully perform changes, commit Coredev创建分支“branches / lib2-fixes”,成功执行更改,提交
  • Frontman monitor repo and wait final commits from Coredev Frontman监控回购并等待Coredev的最终提交
  • Frontman have to get somehow updated files for his job and. Frontman必须以某种方式获得他的工作和更新的文件。 Start mergevoodoo magic 开始mergevoodoo魔术
  • If all is OK, frontman have to eliminate some way commiting merged from coredev core-file in his commit 如果一切正常,那么主持人必须在他的提交中消除从coredev核心文件中提交合并的某些方式

DVCS-version DVCS版本

Story is not dramatically shorter and differ in 1 place - when coredev have his finished job, branch delivered to frontman, merged locally. 故事并没有显着缩短,并且在一个地方有所不同 - 当coredev完成他的工作时,分支交付给主管,在本地合并。 Later merged work can be branched-cleaned-stripped into ready to publish for public form (cherry-picking, history rewrite etc) 以后合并的工作可以分支清理 - 剥离到准备发布公共表单(挑选樱桃,历史重写等)

I really feel like I have missed the point about decentralised workflows 我真的觉得我错过了关于分散工作流程的观点

Wherever I've used Git, both personally(Github) and at $work, it's mainly a centralized model. 无论我在哪里使用Git,无论是个人(Github)还是工作,它主要是一个集中模型。 However, the only advantage I see with the decentralized model is speed. 然而,我看到分散模型的唯一优势是速度。 I'm pretty sure it is way faster to commit a few times during the day locally and then trigger a push to the central repo at the end of the day. 我敢肯定它是方式更快地犯白天几次局部 ,然后触发push在一天结束的中央回购。 Compare that (speed) to making multiple commits to a remote repository everyday. 将(速度)与每天多次提交到远程存储库进行比较。

I'm confused, what is it you're trying to understand here? 我很困惑,你在这里想要了解的是什么? You essentially say "I know why git is great", then proceed to ask "why is git great?" 你基本上说“我知道为什么git很棒”,然后继续问“为什么git很棒?” This has the feeling of not really being a question, or at least a question that is rather ambiguous in what is being asked for. 这种感觉并不是真正的问题,或者至少是一个在要求的问题上相当模糊的问题。

If you're asking specifically how a DVCS improves workflow, then I'd say it does in that every user has their own copy of the repository, and as such can work completely independently, but still retain the ability to merge back with others working on the same repository. 如果您具体询问DVCS如何改进工作流程,那么我会说它确实每个用户都有自己的存储库副本,因此可以完全独立工作,但仍保留与其他工作人员合并的能力在同一个存储库中。

Ex: say Joe is working on "project A", and I am also working on project A. Joe & I can go crazy, doing commits, refactoring, etc, etc, but at the end of the day still combine our code (this is essentially the model of Github -- you fork a project, do crazy stuff, but because your copy is a clone of the original, it's always possible to easily merge your changes back into the original). 例如:说Joe正在研究“项目A”,我也在研究项目A. Joe和我可以发疯,做提交,重构等等,但是在一天结束时仍然会结合我们的代码(这个本质上是Github的模型 - 你分叉项目,做疯狂的东西,但因为你的副本是原始的克隆,所以总是可以轻松地将你的更改合并回原始版本)。

But I feel that I've missed what it is you're asking. 但我觉得我已经错过了你的要求。

You might perhaps also wish to take a look at Version Control By Example which is a free e-book that discusses some various pros and cons of different DVCS's (git just being one). 您或许也希望看看Version Control by Example这是一本免费的电子书,它讨论了不同DVCS的各种优缺点(git只是一个)。 Perhaps the answer you seek is in there. 也许你寻求的答案就在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM