CVS Branch and Merge Example

CVS、Subversion、git三代版本控制系统的演进逻辑与工程选型 版本控制系统(VCS)是软件工程中支撑协作、追溯与发布的基础设施,其本质是‘变更追踪引擎’而非简单备份工具。从CVS开创的复制-修改-合并模型,到Subversion实现的原子提交与全局版本号,再到git以快照存储和分布式架构重构开发范式,每一次演进都回应着真实团队在规模、可靠性与自由度上的核心诉求。理解CVS的delta存储、Subversion的集中式事务、git的SHA-1快照与分支指针机制,不仅关乎命令行操作,更决定CI/CD设计、审计合规路径与跨团队协作效率。本文深入解析三大系统的技术原理、历史动 阅读详情

CVS Branch and Merge Example

Let's say you have a repository containing a single file mypoem.txt that is ready to release.  Let's look at the file  contents:

% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
eat her curds and whey.

When you officially "release" the file to your customers you create a tag in the repository, a symbolic reminder of the state of the repository at a certain point in time.  The -b option says we want to associate the tag with a  new branch of the repository.  Maintenance will occur in the branch while new development will continue on the trunk.  Let's name our tag release-1 using the cvs tag command.  The command is issued from within your working directory, but it really affects the repository.

% cvs tag -b release-1 

Note: the working directory still contains the trunk (not the branch we just created)  -- any changes committed here will go into the trunk of the repository.  So now our developers can happily begin working on release 2 which will contain the "new features and enhancements" -- the next stanza of the poem.

% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
eat her curds and whey.

Along came a strider
and sat up beside her.

The developers add their new work to the trunk. 

% cvs update mypoem.txt
% cvs commit mypoem.txt
Note the new work hasn't been tested yet;  it has defects.  It's still under development.

Parallel development

After a few days of new development the customer reports a defect in Release 1. The word "eat" is supposed to be "eating." They want a patch in a hurry.  It's not a good idea to make the fixes in the trunk because it has unstable new development in it. The fixes can't get released until the new development stabilizes. The customer would have to wait until the next major release before they can get the fixes. They can't wait that long.  So we have to make the fixes in the maintenance branch.

To begin work on the maintenance branch, we need to get the source from the branch by referring to the tag.
% cvs update -r release-1 mypoem.txt
U mypoem.txt

% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
eat her curds and whey.
Notice that we are back to the Release 1 version of the file.

The diagram shows the situation with new versions of development going in the main trunk and bug fixes going in the maintenance branch.  (Specific reversion numbers are arbitrary.)
             
+---------+
Release-1 -> __! 1.2.2.1 ! <- the maintenance branch
/ +---------+
/
/
+-----+/ +-----+ +-----+
! 1.0 !---! 1.1 !----! 1.2 ! <- The main trunk
+-----+ +-----+ +-----+
Now we repair the Release 1 file only in the maintenance branch.
% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
eating her curds and whey.
% cvs update mypoem.txt
% cvs commit mypoem.txt
As soon as the fixes are in we can create a Release 1.1 patch that we can give the customer immediately.  The patch will be made from the maintenance branch and will contain none of the new development.   In the meantime new development can occur on our main development line (trunk) without any interference from bugfixes.

When we are done with bug fixing we can return to working on Release 2.  We update our working directory using the -A flag to revert our working directory to the files on the trunk.
% cvs update -A mypoem.txt
And we see that the file in our working directory is the one in the trunk.
% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
eat her curds and whey.

Along came a strider
and sat up beside her.
We continue development in the trunk getting the next stanza of the poem in order. It would be silly to do bugfixes two times, one time in the branch and one time in the trunk. So we ignore those little Release 1 defects and concentrate on putting in the new features. 
% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
eat her curds and whey.

Along came a spider
and sat down beside her.
% cvs update mypoem.txt
% cvs commit mypoem.txt

Merging maintenance changes into the trunk

Now the new features are finished but the trunk doesn't have the bug fixes we made to create the patch release. At this point we want to combine the bug fixes from the maintenance branch with the new development.  This is called merging.  We use the -j flag to merge the branched sources into the sources in our working directory.

% cvs update -j release-1

There could quite possibly be conflicts if any of the bug fixes overlap the new development.  Watch for the message "conflicts during merge" in the CVS output to indicate conflict.    For example, after merging the Release 1 poem our source file has conflicts shown where the <<<<<<< symbols appear.

% cat mypoem.txt
Little Miss Muffet
sat on a tuffet
<<<<<<< mypoem.txt
eat her curds and whey.

Along came a spider
and sat down beside her.
=======
eating her curds and whey.
>>>>>>> 1.3.2.1

Any conflicts must be manually resolved by editting the file and running the tests again.  When all is done we can commit the changes.

% cvs update mypoem.txt
% cvs commit mypoem.txt
Here is the view after the merge.  It shows new development in parallel with bugfixes and then merging the sources back into the trunk.  At this point , the patches are also in our main development line.
             
+---------+
Release-1 -> __! 1.2.2.1 !____ <- the maintenance branch
/ +---------+ /
/ /
/ /
+-----+/ +-----+ +-----+ /+-----+
! 1.0 !---! 1.1 !----! 1.2 !----! 2.0 ! <- The main trunk
+-----+ +-----+ +-----+ +-----+

Lastly we tag and branch the next release.

% cvs tag -b release-2 

Finding out where you are

It's easy to forget if our working directory has source from the trunk or a branch.  Use cvs status frequently to check where you are.
% cvs status mypoem.txt
===================================================================
File: mypoem.txt Status: Up-to-date

Working revision: 1.3.2.1 Sat Apr 10 18:33:47 2004
Repository revision: 1.3.2.1 cvsroot/mypoem.txt,v
Sticky Tag: release-1 (branch: 1.3.2)
Sticky Date: (none)
Sticky Options: (none)
Notice the Sticky Tag: field shows if we are working on the branch.  If we are in the trunk it will say (none).

Summary: Checking out sources

To checkout the trunk:
% cvs checkout . 

To check out the branch

% cvs checkout -r release-1 .

The -r flag will set a "sticky tag" in the CVS/Tag file, so that most subsequent CVS commands (including commit and update) operate on the branch instead of on the trunk, without your having to specify the branch name. For example, if you have used checkout -r to get the latest copies of the maintenance files, and then changed mypoem.txt, you can commit changes by the usual method:

% cvs update mypoem.txt
% cvs commit

Note: It's recommended to follow the general strategy shown here of doing bugfixes on the fix branch and merging them to the main branch. Doing it the other way around can easily lead to the wrong changes being merged onto the fix branch (e.g. code changes related to new features that aren't implemented on the fix branch).


Here is the official CVS documentation on Branching and Merging.
Comments? Email the author .

This document was modified from the original at http://www.phenix.bnl.gov/~pope/cvs-branch.html
 
CVS、SVN与Git版本控制系统实战选型指南 版本控制系统是软件工程的基础设施,其核心在于对代码变更的建模方式——从CVS的行级差异叠加、SVN的中心化事务提交,到Git的内容寻址分布式图谱。不同架构决定了原子性保障、分支语义、审计能力与离线操作等关键能力边界。在遗留系统维护、强合规交付、云原生协同等真实场景中,技术选型不能仅看性能指标或流行度,而需匹配组织流程、基础设施约束与法务要求。本文聚焦CVS关键字扩展兼容、SVN中央审计日志刚需、Git多源异步合并实践等高频痛点,提供跨代际仓库迁移、混合协议桥接与故障速查的工程化落地方案。 阅读详情

相关推荐

cvs分支以及合并的详细处理

对cvs中进行详细的介绍 分支 和 合并处理;

cvs merge操作

cvs merge中的branch or version 用来选择要被合并的分支;Common base version 选择该分支的起点tag,之后cvs会将被合并的分支和该tag作比较后将两者有差异的文件与本地文件作比较,方便合并。...

zhouminchinahz的博客 890

突发环境事件怎么模拟?用Python+GIS实现高斯烟团模型(附完整代码)

本文详细介绍了如何利用Python与GIS技术实现高斯烟团模型,用于模拟化工泄漏等突发环境事件的动态扩散过程。通过核心原理讲解、参数快速获取方案、Python代码实现及GIS可视化集成,为环境应急人员提供了一套完整的解决方案。特别适合危险品运输事故等瞬态污染场景的应急决策支持。

weixin_33692284的博客 486

关于cvs merge的问题的研究

为什么80%的码农都做不了架构师?>>> ...

weixin_34007020的博客 229

DIY必备:如何用N-MOS管搭建低成本DC有刷电机驱动电路(附原理图+避坑指南)

本文详细介绍了如何使用N-MOS管搭建低成本、高可靠性的DC有刷电机驱动电路。针对DIY爱好者,从核心原理、电路设计、元件选型到焊接调试,提供了完整的实战指南,并重点解析了续流二极管选型、栅极驱动设计等关键避坑要点,帮助读者成功驱动电机并确保电路稳定运行。

delta的博客 775

树莓派4B(Raspbian buster系统)安装ROS Melodic(附带网络配置和远程桌面控制说明)

树莓派4B(Raspbian buster系统)安装ROS Melodic(附带网络配置和远程桌面控制说明) 一、硬件准备 二、软件准备 三、安装前的准备工作 四、开始ROS的安装 五、运行小乌龟 由于坑比较多希望大家安装的时候尽量不要跳步进行,一定要等每一步运行成功了再往下进行。 一、硬件准备 1、树莓派4B一个 2、SD卡一张(最好是16G以上的我的是用的64G的) 3、显示器、键盘、鼠标 二、软件准备 1、Raspberryimage (写系统使用的) 链接:https://pan.baidu.com

weixin_45315065的博客 1万+

CVS分支合并指南

为什么80%的码农都做不了架构师?>>> ...

weixin_34355881的博客 557

Keil-C51 与 Keil -ARM 共存的方法

本篇为《嵌入式相关》系列博客的第五篇,该系列博客主要记录单片机开发及硬件设计的相关过程,方便以后查阅。 Keil-C51 与 Keil -ARM 共存的方法状况解决方案1测试解决方案2 状况 今天装完Keil-C51,然后又换装了Keil-ARM之后,可以正常编译STM32 的工程,但是无法编译C51的工程,并且出现了如下错误: *** Error: Project ‘template’ requires ‘C51’ Toolchain which is not installe 这种情况就是Keil-

梁小憨憨的博客 1万+

CVS介绍

CVS三部曲:拷贝,修改,合并   简单的说,CVS是一个遵循GNU的开源客户机/服务器端系统,允许多个开发人员通过一个中心版本控制系统来记录文件版本,从而达到保证文件同步的目的。这种客户机/服务器工作模式使得开发者可以从任何因特网的接入点存取最新的代码。    CVS的工作原理很简单,就是Copy-Modify-Merge(拷贝、修改、合并)。具体来讲:CVS服务器端创建一个源代码库

不忘初心 1万+

STM32F407实现LwIP的MQTT客户端并连接到服务器

这个是用LwIP协议栈中自带的MQTT客户端API写成的,代码注释很详细,附带有服务端的展示。LwIP版本是2.1.2.

wait_for_STM32的博客 6394

在群辉(NAS)中安装虚拟机套件(Virtual Machine Manager)

一、在群辉中下载虚拟机套件Virtual Machine Manager ①启用Open vSwitch(网络-->管理--启用Open vSwitch) ②打开“套件中心” ③查找到Virtual Machine Manager套件点击“安装套件” 二、安装虚拟机套件(Virtual Machine Manager) ①打开虚拟机套件运行设置向导 ②选择存储空间...

提供C#相关开发 、云计算、运维测试、网络安全相关技术分享与服务,有意向可联系。 2万+

对CVS,SVN等软件版本管理中Tag,branch,merge的一点理解

对于项目开发过程中,会出现以下的一些情况:(1)对于某个项目开发了一定的阶段,决定发布一个初始版本V1.0;(2)V1.0版本上线,对于该项目继续开发(可能增加新的特性、功能升级等升级至V2.0),此时对于原先的代码已经进行了改动;(3)此时在V1.0中发现了一个BUG,需要马上改动,或者需要在V1.0中紧急加入一个特性,需要对于源代码进行修改了。没有版本控制,这个时候麻烦来了。考

moxuansheng的专栏 2705

赛豆科技 AIVA 汽车智能体架构演进面试题与答案

摘要 赛豆科技AIVA汽车智能体架构从座舱AI演进到整车智能体,最终实现自进化的超级智能体。其核心是"先有AI再有车"的理念,将AI作为产品主轴而非附加功能。架构设计采用端-边-云协同,确保低延迟响应;整车智能体通过Planner、Tool Registry等关键组件实现自主决策;自进化机制结合车端个性化学习和云端群体学习,并设置多重安全验证。多域协作采用分层架构,关键安全功能仍由确定性逻辑控制。该架构实现了从被动响应到主动服务的范式转变,使车辆能够持续进化。

AI天才研究院 122

CVS、Subversion 与 Git 版本控制底层原理深度解析

版本控制系统是软件开发的基础设施,其核心在于数据模型设计与协作语义约定。CVS 基于文件级 RCS 补丁链,依赖时间戳与显式加锁,导致无原子提交和分支脆弱;Subversion 引入全局修订号与树状快照,实现原子事务与真分支,但强耦合中心服务器;Git 采用内容寻址的 DAG 对象图,通过 SHA-1 哈希保障状态一致性,支撑分布式、离线操作与历史重写能力。这些差异直接决定冲突解决方式、分支开销、迁移成本及协同可靠性。理解 CVS 的 strict 锁机制与 git 的 staging 区设计,是规避日常

as2886089的博客 360

【项目解析】2KW 230V 数字逆变器控制系统(二)

【项目解析】 2KW 230V 数字逆变器控制系统(一) 项目的 交流输出电压 并不是单纯一个电压环就能控制好的,而是典型的 双环控制架构:最终占空比控制量会经过计算: 然后写入 单片机 TMM 定时器的比较寄存器 (TMGRA0/TMGRD0/TMGRC1), → 定时器输出互补 PWM, → 驱动 IGBT 全桥, → 经过 LC 滤波形成 230 VAC / 50Hz 的正弦电压。总结交流电压是双环控制的结果:目标/作用:把输出 RMS 电压稳到目标(例如 230 VAC);在母线波动与负载变化下

Naiva的博客 1298

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

CVS、SVN与Git:集中式到分布式版本控制演进史

版本控制是软件工程的基础设施,其核心在于如何安全、可追溯地管理代码变更。从CVS的文件级悲观锁与线性修订号,到SVN的原子提交与目录版本化,再到Git基于内容寻址与有向无环图(DAG)的分布式对象模型,每一次范式跃迁都源于对协作效率、网络可靠性与历史完整性等现实约束的回应。CVS强调中心权威与人工协调,SVN强化事务一致与企业审计,Git则将副本自治与分支轻量化推向极致。理解这三者的原理差异,不仅有助于遗留系统维护与迁移决策,更能指导团队在发布频率、团队规模、合规要求等维度建立匹配的协作契约。本文深入剖析C

rongdmmap的博客 441

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Linux上 Git 的简介、安装及操作详解(操作windows、linux通用)

我们知道,在公司中,一个项目通常是由一个团队来协作开发的,就比如一个项目由小红、小花、小李、小美四个人组成的团队来合作开发,有一天,小红完成了项目的一个小功能,并把它上传到了公司服务器上,但是小花觉得这个功能中的一部分代码可以优化,于是她从服务器上下载了小红的代码并对其进行修改,同时小李也从服务器上下载了该代码进行优化,那么这时候就会发生两个问题:第一,修改完成上传后,小李修改后的代码会直接覆盖掉小花修改的代码,导致小花的努力白费;

liu_chen_yang的博客 5191

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Git 版本控制核心原理深度解析:从对象模型到分支策略与工程化实战

本文从Git对象模型blob/tree/commit/tag出发,深入解析引用系统、工作区暂存区仓库三区模型、分支操作本质、merge与rebase原理、冲突处理三路合并算法、远程操作与跟踪分支,以及Git Flow、GitHub Flow、GitLab Flow三种分支策略实践。

热爱技术与前沿创新,深耕科技领域,在科创中精进自我;探索技术乐趣,分享技术干货与成长心得,以技术为伴,热爱生活,在科创与生活中双向成长。 377

GitLab,GitHub,Gitee等平台的差别在哪?好多人没搞懂!!!

GitLab,GitHub,Gitee等平台的差别在哪?好多人没搞懂!!!——深度解析与实战指南。

热爱技术与前沿创新,深耕科技领域,在科创中精进自我;探索技术乐趣,分享技术干货与成长心得,以技术为伴,热爱生活,在科创与生活中双向成长。 823

CVS Branch 和 Merge 在 Eclipse 中的使用

http://blog.youkuaiyun.com/sanshiqiduer/article/details/2423936 CVS Branch 和 Merge 在 Eclipse 中的使用 Branch: 我们在version Release_1_0建立一个branch,比如叫做“Release_1_0_Branch”, 这时CVS会同时建立一个regular tag “Root_of_Relea

走马观花 1847

如何在eclipse中使用分支合并功能

source:http://blog.youkuaiyun.com/zhuhl520/archive/2005/02/05/281901.aspx     我们的项目在某一阶段通常会发布一个版本,供客户进行使用,然后我们会继续开发下一个版本,如果这时候客户正在使用的那个版本发现了bug,我们当然需要更改bug,并且给客户发布更新补丁包。这时就需要创建基本此版本的一个分支,分支创建完成后,我们同时还需要

§为艺术而技术§ 2052

版本控制工具

版本控制工具    版本控制是程序开发、管理必不可少的工具,特别是在多人协作的团队中,适宜的版本控制工具可以提高开发效率,消除很多有代码版本带来的问题。本文首先列举没有版本控制工具时可能遇到的问题,再对主流版本控制工具做概要介绍,之后对作为Java开发者首选的版本控制工具CVS的历史、功能、概念做详细的介绍;最后在Eclipse+CVS环境中,以CVS使用的一个完整流程为例,介绍如何正确的使用CV

moxie的专栏 3424

用ssh方式访问cvs的配置

1.环境: redhat 2.服务器配置a.设置用户能通过ssh方式登入cvs serverb.确定/etc/service文件有如下两行cvspserver 2401/tcp cvspserver 2401/udp c.在/etc/xinetd.d目录下建立cvspserver文件,内容如下service cvspserver{ disable = no flags = REUSE socke...

JAVA天地 316
上一篇: 关于项目管理的知识点
下一篇: 几个有用的网址~~
浩西
博客等级 码龄19年 47粉丝 48原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值