避免代码合并冲突_避免合并冲突-情节提要版

2023-12-27 14:40

本文主要是介绍避免代码合并冲突_避免合并冲突-情节提要版,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

避免代码合并冲突

情节提要参考和交流可以节省一天 (Storyboard References and Communication Save the Day)

I recently worked on a 1-week quick prototype project with a few junior developers. Most of the developers on the team preferred that we use storyboards because it’s what they’re most familiar with.

我最近与几个初级开发人员一起进行了为期1周的快速原型项目。 团队中的大多数开发人员更喜欢我们使用情节提要,因为这是他们最熟悉的。

Though I’m one that prefers working in storyboards, I was not looking forward to the incessant merge conflicts. Meeting after meeting of “which side do I pick?” — storyboards are written in XML if you didn’t know (right-click a storyboard file -> Open As -> Source Code if you want to see for yourself). This makes it difficult for some developers who aren’t familiar with XML to decipher what’s what.

尽管我是一个更喜欢在情节提要中工作的人,但我并不希望不断出现合并冲突。 “我选哪一边? —如果您不知道,情节提要是以XML编写的(如果要自己查看,请右键单击情节提要文件-> 打开方式->源代码 )。 对于一些不熟悉XML的开发人员来说,这很难解释什么。

好消息是……在一周结束时,我们……合并冲突。 只有一个。 这是我们的工作方式… (The Good News Is… At The End Of The Week, We Had… One Merge Conflict. Just one. Here’s how we did it…)

One thing you’ll notice throughout this story is you’re going to hear a lot of “we” as opposed to “I”. That’s because teamwork is paramount to avoiding merge conflicts, and we truly worked as a unit. That’s not to say someone wasn’t the lead — a team needs a leader, after all, someone to provide direction.

在整个故事中您会注意到的一件事是,您将听到很多“我们”而不是“我”。 这是因为团队合作对于避免合并冲突至为重要,而我们确实是一个整体。 这并不是说某人不是领导者–团队需要领导者,毕竟,有人需要提供指导。

When I say we had one merge conflict related to storyboards, I don’t mean one merge conflict that we couldn’t figure out. I mean one merge conflict. Period. We had more merge conflicts related to what I refer to as “greedy” lines of code. That is to say lines of code we don’t agree with others on, and change or lines we change to shortcut something for our own development experience and forget to change back before merging into a common branch.

当我说我们有一个与情节提要相关的合并冲突时,我并不是说我们无法弄清一个合并冲突。 我的意思是合并冲突。 期。 与我所说的“贪婪”代码行有关的合并冲突更多。 就是说,我们不同意的代码行,或更改或更改我们的行来为自己的开发经验捷径,而在合并到公共分支之前忘了更改。

每个开发人员都有自己的分镜脚本,每个开发人员都有自己的分支 (Each Developer Gets Their Own Storyboard, Each Developer Gets Their Own Branch)

The size of the storyboards is up to you and your team, but the less that’s going on in each storyboard, the less of a chance there is for a merge conflict. Two of our storyboards only had one View Controller each!

故事板的大小取决于您和您的团队,但是每个故事板中发生的事件越少,合并冲突的机会就越少。 我们的两个情节提要板每个只有一个View Controller!

We may have gone a little overboard with branches, but the strategy worked. We had a master branch, a common develop branch, and each of us had personal branches. I organized my personal branches by feature, some went by day, some seemed to have no coherent strategy for their personal branch strategy. One thing we all agreed on was that the common branches needed to remain as clean and up to date as possible.

我们可能在分支机构方面有些过分,但是该策略有效。 我们有一个主分支,一个公共开发分支,每个人都有个人分支。 我按功能组织了我的个人分支机构,有的是日常工作,有的似乎对其个人分支策略没有统一的策略。 我们都同意的一件事是,公共分支机构需要保持尽可能干净和最新的状态。

We each picked an MVP feature to own. None of the MVP features resided in just one storyboard, so occasionally, it was necessary to delve into someone else’s storyboard file. That said, each file had an “owner”. This person was responsible for knowing what should be going on with that storyboard. That doesn’t mean whatever they said was what happened, it just means that was the point of contact for working in that file.

我们每个人都拥有一个MVP功能。 MVP功能没有一个驻留在一个情节提要中,因此偶尔需要深入研究其他人的情节提要文件。 也就是说,每个文件都有一个“所有者”。 此人负责了解该故事板应如何处理。 这并不意味着他们说的是发生了什么,仅意味着这是处理该文件的联系点。

Image for post

So if Developer A wanted to work in Developer B’s storyboard file, Developer A would shoot them a message on Slack, and say “Hey, I’m working on feature X, and I need to work in your storyboard file. Is that ok?” Then they would wait for Developer B to respond before even starting to work in the storyboard file in their own branch.

因此,如果开发人员A要使用开发人员B的情节提要文件,则开发人员A会在Slack上向他们发送一条消息,然后说:“嘿,我正在使用功能X,我需要处理您的情节提要文件。 那样行吗?” 然后,他们将等待开发人员B响应,甚至开始在自己分支的情节提要文件中工作。

This is key takeaway number 1. Developer B owns the file and should know if Developer C is working on it (or obviously if they’re working on it). They can then let Developer A know to hold off because someone else is making changes to that file.

这是关键要点编号1。开发人员B拥有文件,并且应该知道开发人员C是否正在处理该文件(或者显然他们是否正在处理该文件)。 然后他们可以让开发人员A知道推迟执行,因为其他人正在对该文件进行更改。

Let’s say Developer C was working on this particular storyboard file at the time. When they’re done, what they’re going to do is commit their work, pull down from the main develop branch, handle any conflicts (if there were any) in their own branch, then push up to the common develop branch. If there were any question whatsoever about what line of code to pick in a conflict, a meeting would be held between any involved parties, but normally we’d already have it figured out beforehand because we talked about it.

假设开发人员C当时正在处理此特定的故事板文件。 完成后,他们要做的是提交工作,从主开发分支中撤出,在自己的分支中处理任何冲突(如果有),然后向上推进到通用开发分支。 如果对在冲突中选择哪种代码行存有任何疑问,将在任何相关方之间举行会议,但是通常我们已经事先弄清楚了,因为我们已经讨论过了。

Before they push up though, they’d let everyone know that their changes were being pushed up to the common develop branch so everyone had an opportunity to review their changes if they wanted to — though we rarely needed to.

但是,在推销之前,他们会让每个人都知道他们的更改已被推到通用开发部门,因此每个人都有机会(如果我们愿意)查看他们的更改-尽管我们很少需要这样做。

At the end of the day, we’d review the common develop branch together and decide if it was clean enough to push up to Master.

归根结底,我们将共同审查通用开发分支,并确定它是否足够干净以提升到Master。

Image for post

You may be wondering, “ if there’s as little as possible going on in each storyboard, and sometimes a storyboard only has 1 View Controller, how do you handle segues?”

Ÿ欧可能会想,“如果有尽量少在各个分镜图下去,有时一个故事板只有1视图控制器,你如何处理塞格斯?”

We didn’t handle any segues programmatically except for a conditionally presented login view. We used Storyboard references for the rest of the project

除了有条件显示的登录视图外,我们没有以编程方式处理任何问题。 我们在项目的其余部分中使用了Storyboard参考

Image for post
An example of a project using Storyboard References
使用情节提要参考的项目示例
Image for post
Image for post
Image for post

清晰的沟通+情节提要参考+合并策略=轻松解决冲突 (Clear Communication + Storyboard References + Merge Policy = Easy Conflict Resolution)

Is all of this necessary to avoid merge conflicts? Honestly, probably not.

所有这些都是必要的,以避免合并冲突吗? 老实说,也许不是。

By communicating clearly, you can avoid merge conflicts before they even start. If everyone knows their role, and no two people have a conflicting role or people who do have conflicting roles discuss who will be owning what, a lot of merge conflicts are prevented.

通过清楚地沟通,您可以避免合并冲突甚至开始。 如果每个人都知道自己的角色,并且没有两个人有冲突的角色,或者确实有冲突的人讨论谁将拥有什么,那么可以避免很多合并冲突。

By using multiple storyboards, and again, each person knowing their role — a lot of conflict is avoided.

通过使用多个情节提要板,每个人都知道自己的角色,避免了很多冲突。

By having a clear merge policy that everyone agrees on and utilizes as it should be, we all have the confidence that what we’re about to push up to a common branch isn’t going to cause catastrophic changes to the project.

通过制定清晰的合并政策,每个人都应同意并利用它,我们所有人都有信心,我们将要推进到一个公共分支的项目不会对项目造成灾难性的变化。

I’m not saying if you do all of these things I mentioned in this article, you won’t have any merge conflicts, but I’m willing to bet you’ll have a whole lot less.

我并不是说,如果您执行了本文中提到的所有这些操作,则不会有任何合并冲突,但是我敢打赌,您的工作量会少很多。

I’d love to hear what you think in the comments.

我很想听听您在评论中的想法。

翻译自: https://medium.com/swlh/avoid-merge-conflicts-storyboard-edition-2a02ceadaf6c

避免代码合并冲突


http://www.taodudu.cc/news/show-8403641.html

相关文章:

  • rest_REST /使用提要发布事件
  • 敏捷场景和情节提要
  • atom创建文件_在PHP中创建Atom提要
  • rss atom_有效的XML,提供更友好的RSS和Atom提要
  • Ajax知识点提要
  • wpf 情节提要有什么用_将情节提要对象连接到代码
  • wordpress本地开发_WordPress提要开发人员指南
  • 电气工程学科规划提要(征求意见稿)
  • 【数据库/MySQL】MySQL三大日志提要
  • WordPress初学者入门教程-RSS提要
  • FPGA 仿真与实际不一样,仿真没有打拍,仿真时钟问题。
  • 【程序设计】Matplotlib运行错误的解决方法
  • 自动化工具-在保留白名单文件的前提下,删除剩余文件
  • Linux Shell 学习笔记二
  • 【Rust 易学教程】学前准备:Cargo, 你好
  • 『亚马逊云科技产品测评』活动征文|基于亚马逊EC2云服务器部署Gogs服务
  • 基于Arduino的GPS与单片机通信 GPS与PC机的通信
  • 企业工业网络搭建
  • C#工业生产MES上位机工具 新能源转子生产线 完整工程代码 串口 RFID通信 PLC
  • 探究MES系统:工业生产数字化转型的必需品
  • Python 在工业生产规划中的应用
  • Ubuntu16配置caffe和faster RCNN
  • [VB.NET]单元七 图形图像处理1
  • 现代opengl 设计入门,画图第一个三角形
  • 一些vbs和bat的小脚本 好戏总是在后面哦 大佬您第一次来吧?是不是都进来看看吧=w=
  • 第N+1次踩坑Caffe小计
  • VB检测硬件信息
  • 【原创】Linux环境下的图形系统和AMD R600显卡编程(10)——R600显卡的3D引擎编程...
  • ubuntu16安装tensorflow gpu加速(包括cuda8及NVIDIA显卡安装)
  • 获取windows显卡使用率,并写入txt文档
  • 这篇关于避免代码合并冲突_避免合并冲突-情节提要版的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



    http://www.chinasem.cn/article/543459

    相关文章

    使用Python创建一个能够筛选文件的PDF合并工具

    《使用Python创建一个能够筛选文件的PDF合并工具》这篇文章主要为大家详细介绍了如何使用Python创建一个能够筛选文件的PDF合并工具,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录背景主要功能全部代码代码解析1. 初始化 wx.Frame 窗口2. 创建工具栏3. 创建布局和界面控件4

    javaScript在表单提交时获取表单数据的示例代码

    《javaScript在表单提交时获取表单数据的示例代码》本文介绍了五种在JavaScript中获取表单数据的方法:使用FormData对象、手动提取表单数据、使用querySelector获取单个字... 方法 1:使用 FormData 对象FormData 是一个方便的内置对象,用于获取表单中的键值

    Vue ElementUI中Upload组件批量上传的实现代码

    《VueElementUI中Upload组件批量上传的实现代码》ElementUI中Upload组件批量上传通过获取upload组件的DOM、文件、上传地址和数据,封装uploadFiles方法,使... ElementUI中Upload组件如何批量上传首先就是upload组件 <el-upl

    Python自动化办公之合并多个Excel

    《Python自动化办公之合并多个Excel》在日常的办公自动化工作中,尤其是处理大量数据时,合并多个Excel表格是一个常见且繁琐的任务,下面小编就来为大家介绍一下如何使用Python轻松实现合... 目录为什么选择 python 自动化目标使用 Python 合并多个 Excel 文件安装所需库示例代码

    C++使用栈实现括号匹配的代码详解

    《C++使用栈实现括号匹配的代码详解》在编程中,括号匹配是一个常见问题,尤其是在处理数学表达式、编译器解析等任务时,栈是一种非常适合处理此类问题的数据结构,能够精确地管理括号的匹配问题,本文将通过C+... 目录引言问题描述代码讲解代码解析栈的状态表示测试总结引言在编程中,括号匹配是一个常见问题,尤其是在

    Java调用DeepSeek API的最佳实践及详细代码示例

    《Java调用DeepSeekAPI的最佳实践及详细代码示例》:本文主要介绍如何使用Java调用DeepSeekAPI,包括获取API密钥、添加HTTP客户端依赖、创建HTTP请求、处理响应、... 目录1. 获取API密钥2. 添加HTTP客户端依赖3. 创建HTTP请求4. 处理响应5. 错误处理6.

    使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

    《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景

    Python中顺序结构和循环结构示例代码

    《Python中顺序结构和循环结构示例代码》:本文主要介绍Python中的条件语句和循环语句,条件语句用于根据条件执行不同的代码块,循环语句用于重复执行一段代码,文章还详细说明了range函数的使... 目录一、条件语句(1)条件语句的定义(2)条件语句的语法(a)单分支 if(b)双分支 if-else(

    MySQL数据库函数之JSON_EXTRACT示例代码

    《MySQL数据库函数之JSON_EXTRACT示例代码》:本文主要介绍MySQL数据库函数之JSON_EXTRACT的相关资料,JSON_EXTRACT()函数用于从JSON文档中提取值,支持对... 目录前言基本语法路径表达式示例示例 1: 提取简单值示例 2: 提取嵌套值示例 3: 提取数组中的值注意

    CSS3中使用flex和grid实现等高元素布局的示例代码

    《CSS3中使用flex和grid实现等高元素布局的示例代码》:本文主要介绍了使用CSS3中的Flexbox和Grid布局实现等高元素布局的方法,通过简单的两列实现、每行放置3列以及全部代码的展示,展示了这两种布局方式的实现细节和效果,详细内容请阅读本文,希望能对你有所帮助... 过往的实现方法是使用浮动加