分支与合并

目录

什么是分支?
使用分支
创建分支
在分支上工作
The Key Concepts Behind Branching
Basic Merging
Changesets
Keeping a Branch in Sync
Mergeinfo and Previews
取消修改
找回删除的项目
Advanced Merging
Cherrypicking
Merge Syntax: Full Disclosure
Merges Without Mergeinfo
More on Merge Conflicts
Blocking Changes
Merge-Sensitive Logs and Annotations
关注还是忽视祖先
合并和移动
Blocking Merge-Unaware Clients
使用分支
标签
建立简单标签
建立复杂标签
分支维护
版本库布局
数据的生命周期
常用分支模式
发布分支
特性分支
Vendor Branches
常规的供方分支管理过程
svn_load_dirs.pl
总结
 

君子务本

 
 --孔子

Branching, tagging, and merging are concepts common to almost all version control systems. If you're not familiar with these ideas, we provide a good introduction in this chapter. If you are familiar, then hopefully you'll find it interesting to see how Subversion implements them.

分支是版本控制的基础组成部分,如果你允许Subversion来管理你的数据,这个特性将是你所必须依赖的,这一章假定你已经熟悉了Subversion的基本概念(第 1 章 基本概念)。

什么是分支?

Suppose it's your job to maintain a document for a division in your company—a handbook of some sort. One day a different division asks you for the same handbook, but with a few parts “tweaked” for them, since they do things slightly differently.

What do you do in this situation? You do the obvious: make a second copy of your document and begin maintaining the two copies separately. As each department asks you to make small changes, you incorporate them into one copy or the other.

You often want to make the same change to both copies. For example, if you discover a typo in the first copy, it's very likely that the same typo exists in the second copy. The two documents are almost the same, after all; they differ only in small, specific ways.

这是分支的基本概念—正如它的名字,开发的一条线独立于另一条线,如果回顾历史,可以发现两条线分享共同的历史,一个分支总是从一个备份开始的,从那里开始,发展自己独有的历史(见 图 4.1 “分支与开发”)。

图 4.1. 分支与开发


Subversion允许你并行的维护文件和目录的分支,它允许你通过拷贝数据建立分支,记住,分支互相联系,它也帮助你从一个分支复制修改到另一个分支。最终,它可以让你的工作拷贝反映到不同的分支上,所以你在日常工作可以“混合和比较”不同的开发线。