[root@ok svndata]# svn co svn://192.168.1.111/app01
# checkout项目到本机

开始规划我们的svn项目目录:

[root@ok svndata]# tree app01/ 
app01/ #项目根目录
├── branches #其他分支
│   ├── iterative- #迭代分支
│   ├── iterative--feature1 #基于迭代分支的特性1分支
│   └── iterative--feature2 #基于迭代分支的特性2分支
├── tags
└── trunk #主干分支 directories, files

主干分支上创建第一个代码文件:

[root@ok app01]# svn mkdir trunk
A         trunk
[root@ok app01]# touch trunk/hello.py    
[root@ok app01]# svn add trunk/hello.py
A         trunk/hello.py
[root@ok app01]# svn ci -m "init"
Adding         trunk
Adding         trunk/hello.py
Transmitting file data .
Committed revision 7.
[root@ok app01]# svn update
At revision 7.

首先创建分支目录:

[root@ok app01]# svn mkdir branches
A branches
[root@ok app01]# svn ci -m "创建分支目录"
Adding branches Committed revision .
[root@ok app01]# svn update
At revision .

创建分支的方式一:

[root@ok app01]# svn cp trunk/ branches/iterative-
A branches/iterative-
[root@ok app01]# svn ci -m "创建二期迭代分支"
Adding branches/iterative- Committed revision .

创建分分支的方式二:

[root@ok app01]# svn cp svn://192.168.1.111/app01/trunk \
> svn://192.168.1.111/app01/branches/iterative-2 \
> -m "创建二期迭代分支"
注意一定要svn update 否则可能会看不到更新log
[root@ok app01]# svn update
[root@ok app01]# svn log -v
------------------------------------------------------------------------
r11 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
A /branches/iterative- (from /trunk:) 创建二期迭代分支

基于迭代分支创建特性分支:
因为一次迭代开发可能包含很多新功能,面这些个功能可以由N个开发人员来并行开发。所以最佳方案是每个功能点再建一个分支出来,实现之后再合并回二期迭代分支。

[root@ok app01]# svn cp svn://192.168.1.111/app01/branches/iterative-2 \
> svn://192.168.1.111/app01/branches/iterative-2-feature-say-hi \
> -m "2期需求:say hi功能" Committed revision .
[root@ok app01]# svn update
A branches/iterative--feature-say-hi
A branches/iterative--feature-say-hi/hello.py
Updated to revision .
[root@ok app01]# svn ci -m "2期需求:say hi功能"
[root@ok app01]# svn update
At revision .
[root@ok app01]# svn log -v
------------------------------------------------------------------------
r12 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
A /branches/iterative--feature-say-hi (from /branches/iterative-:) 2期需求:say hi功能
------------------------------------------------------------------------
r11 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
A /branches/iterative- (from /trunk:) 创建二期迭代分支
------------------------------------------------------------------------
r10 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
D /branches/iterative-

实现特性功能:

[root@ok app01]# echo "加入代码实现一些功能!!!">branches/iterative--feature-say-hi/hello.py
[root@ok app01]# svn commit -m "say hi 功能"
Sending branches/iterative--feature-say-hi/hello.py
Transmitting file data .
Committed revision .
[root@ok app01]# svn update
At revision .
[root@ok app01]# svn log -v branches/iterative--feature-say-hi/hello.py
------------------------------------------------------------------------
r13 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
M /branches/iterative--feature-say-hi/hello.py say hi 功能
------------------------------------------------------------------------
r12 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
A /branches/iterative--feature-say-hi (from /branches/iterative-:) 2期需求:say hi功能
------------------------------------------------------------------------
r11 | svnroot | -- :: + (Fri, Aug ) | line
Changed paths:
A /branches/iterative- (from /trunk:) 创建二期迭代分支

合并回迭代分支

[root@ok app01]# svn mkdir branches/{iterative--feature1,iterative--feature2}
A branches/iterative--feature1
A branches/iterative--feature2
[root@ok app01]# svn ci -m "基于迭代分支的特性1和2分支"
Adding branches/iterative--feature1
Adding branches/iterative--feature2 Committed revision .
[root@ok app01]# cd branches/iterative--feature1/
[root@ok iterative--feature1]# svn merge svn://192.168.1.111/app01/branches/iterative-2
[root@ok iterative--feature1]# svn commit -m "合并迭代分支的修改"
Sending iterative--feature1 Committed revision .
//自测,没问是后,合并回迭代分支
[root@ok branches]# cd iterative-
[root@ok iterative-]# svn merge --reintegrate svn://192.168.1.111/app01/branches/iterative-2-feature-say-hi
--- Merging differences between repository URLs into '.':
U hello.py
[root@ok iterative-]# svn status
M .
M hello.py
[root@ok iterative-]# svn diff Property changes on: .
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/iterative--feature-say-hi:r12- Index: hello.py
===================================================================
--- hello.py (revision )
+++ hello.py (working copy)
@@ -, + @@
+加入代码实现一些功能!!!
[root@ok iterative-]# svn ci -m "合并回迭代分支"
Sending iterative-
Sending iterative-/hello.py
Transmitting file data .
Committed revision .

使用reintegrate合并后,迭代分支并没有保存特 性分支的提交历史(但是在branches目录下,能看到完整的提交历史)

迭代分支合并到 trunk 中

[root@ok trunk]# svn merge --reintegrate svn://192.168.1.111/app01/branches/iterative-2
--- Merging differences between repository URLs into '.':
U    hello.py
 U   .
[root@ok iterative-2]# svn diff Property changes on: .
___________________________________________________________________
Added: svn:mergeinfo
   Merged /branches/iterative-2-feature-say-hi:r30-33 Index: hello.py
===================================================================
--- hello.py    (revision 31)
+++ hello.py    (working copy)
@@ -0,0 +1 @@
+进行了一些修改 实现了要求达到的功能!!
[root@ok trunk]# svn ci -m "合并到turnk"
Sending        trunk
Sending        trunk/hello.py
Transmitting file data .
Committed revision 36.
[root@ok trunk]# svn update
At revision 36.
[root@ok trunk]# svn log
------------------------------------------------------------------------
r36 | svnroot | 2016-08-26 19:16:30 +0800 (Fri, 26 Aug 2016) | 1 line 合并到turnk
------------------------------------------------------------------------
r27 | svnroot | 2016-08-26 18:40:48 +0800 (Fri, 26 Aug 2016) | 1 line init
------------------------------------------------------------------------

删除特性分支

[root@ok iterative-]# svn rm svn://192.168.1.111/app01/branches/iterative-2-feature-say-hi -m ""

打一个tag:

[root@ok app01]# svn mkdir tags
A tags
[root@ok app01]# svn ci -m ""
Adding tags Committed revision .
[root@ok app01]# svn copy svn://192.168.1.111/app01/trunk svn://192.168.1.111/app01/tags/1.0 -m "1.0 Released" Committed revision .
[root@ok app01]# tree
.
├── branches
│   ├── iterative-
│   │   └── hello.py
│   ├── iterative--feature1
│   ├── iterative--feature2
│   └── iterative--feature-say-hi
│   └── hello.py
├── tags
│   └── 1.0
│   └── hello.py
└── trunk
└── hello.py directories, files
[root@ok app01]# cat tags/1.0/hello.py
进行了一些修改 实现了要求达到的功能!!

------------------------------------------

创建分支:

[root@ok branches]# svn cp -m "create branch" svn://192.168.1.111/app01/trunk svn://192.168.1.111/app01/branches/br_feature001

获得分支:

[root@ok branches]# svn co svn://192.168.1.111/app01/branches/br_feature001
A br_feature001/hello.py
Checked out revision .

合并主干上的最新代码到分支上

[root@ok br_feature001]# svn merge svn://192.168.1.111/app01/trunk

测试如下:

[root@ok br_feature001]# cat hello.py
[root@ok br_feature001]# svn merge svn://192.168.1.111/app01/trunk
--- Merging r18 into '.':
U hello.py
[root@ok br_feature001]# cat hello.py
12k

如果需要预览该刷新操做,可以使用svn mergeinfo:

[root@ok trunk]# svn mergeinfo svn://192.168.1.111/app01/trunk --show-revs eligible
r18

在分支上的开发结束,分支上的代码需要合并到主干,如下步骤:

[root@ok br_feature001]# cat hello.py
12k
[root@ok br_feature001]# svn status
M .
M hello.py
#末把分支合并到主干之前,查看代码:
[root@ok br_feature001]# cat ../../trunk/hello.py
12k
[root@ok trunk]# cat hello.py
12k
更新主干内容!!!
[root@ok trunk]# svn merge --reintegrate svn://192.168.1.111/app01/branches/br_feature001

分支合并到主干中完成后应当删该分支,因为在svn中该分支已经不能进行刷新也不能合并到主干。

[root@ok trunk]# svn log
------------------------------------------------------------------------
r19 | svnroot | -- :: + (Fri, Aug ) | line ------------------------------------------------------------------------
r18 | svnroot | -- :: + (Fri, Aug ) | line 12k
------------------------------------------------------------------------
r7 | svnroot | -- :: + (Fri, Aug ) | line init
------------------------------------------------------------------------
[root@ok trunk]# svn -r : merge svn://192.168.1.111/app01/trunk

建立tags

产品开发已经基本完成,并且通过很严格的测试,这时候我们就想发布给客户使用,发布为1.0版本

[root@ok app01]# svn copy svn://192.168.1.111/app01/trunk svn://192.168.1.111/app01/1.0 -m "Release 1.0"

Committed revision .

可以看出,就是简单的复制动做。

svn分支管理进行迭代开发的更多相关文章

  1. SVN分支管理策略个人见解

    本篇目录 前言 SVN分支管理策略 VisualSVN Server TortoiseSVN客户端 Repository的创建 Check out trunk创建新项目MyProject trunk更 ...

  2. SVN 分支管理

    平时在工作中使用 SVN 只是限于 commit,update 这样的操作,至多再 reslove 解决一下冲突,没有用过分支管理.开发过程中一般都是一个功能开发完成之后整体进行提交,而最近在项目中有 ...

  3. 版本分支管理标准 - Trunk Based Development 主干开发模型

    之前分享过<版本分支管理标准 - Git Flow>,不过在实际使用过程中, 因为其有一定的复杂度,使用起来较为繁琐,所以一些人员较少的团队并不会使用这个方案. 在这基础上,一些新的分支管 ...

  4. git 分支管理方案

    现有一般的公司项目均使用git(大多数是gitLab)管理. 开发组 我们的项目都要建立在 开发组的名下 (git.xxcompany.com/xxgroup),除需要公司内部开源的项目,都必须设置为 ...

  5. Git工程开发实践(四)——Git分支管理策略

    A successful Git branching model https://nvie.com/posts/a-successful-git-branching-model/ Git工程开发实践( ...

  6. Git学习总结(12)——多人开发 Git 分支管理详解

    1.前言 在上一篇博客中我们主要讲解了Git 远程仓库,相信大家对远程的Git仓库有一定的了解,嘿嘿.在这一篇博客中我们来在大家讲解一下Git 分支管理,这可以说是Git的又一大特点.下面我们就来学习 ...

  7. Eclipse集成Git做团队开发:分支管理

    在日常开发工作中,我们通常使用版本控制软件管理团队的源代码,常用的SVN.Git.与SVN相比,Git有分支的概念,可以从主分支创建开发分支,在开发分支测试没有问题之后,再合并到主分支上去,从而避免了 ...

  8. git flow开发分支管理模型

    Git Flow 是什么 Git Flow是构建在Git之上的一个组织软件开发活动的模型,是在Git之上构建的一项软件开发最佳实践.Git Flow是一套使用Git进行源代码管理时的一套行为规范和简化 ...

  9. [svn] 分支开发

    参考博客: http://www.cnblogs.com/cxd4321/archive/2012/07/12/2588110.html (1)为什么要使用SVN分支开发和主干合并? 目的:在SVN下 ...

随机推荐

  1. nginx&apache比较

    1.nginx相对于apache的优点: 轻量级,同样起web 服务,比apache占用更少的内存及资源 抗并发,nginx 处理请求是异步非阻塞的,而apache 则是阻塞型的,在高并发下nginx ...

  2. 微信公众平台开发接口PHP SDK完整版

    <?php /* 方倍工作室 http://www.fangbei.org/ CopyRight 2015 All Rights Reserved */ define("TOKEN&q ...

  3. [LeetCode] Word Ladder II

    Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from ...

  4. android源代码提示文本框还能输入多少个字符

    public class TestAndroidActivity extends Activity { /** Called when the activity is first created. * ...

  5. fatl exception occurred异常/错误的一种可能情况

    如果,有可能是 java.lang.ClassLoader类内部出错,请自行检查

  6. [Socket网络编程]一个封锁操作被对 WSACancelBlockingCall 的调用中断。

    原文地址:http://www.cnblogs.com/xiwang/archive/2012/10/25/2740114.html记录在此,方便查阅. C#中在使用UDPClient循环监听端口,在 ...

  7. ThinkPHP邮件发送函数示例

    ThinkPHP邮件发送函数示例详解 /** * 发送邮件 * @param $tomail * @param $subject * @param $body * @param string $con ...

  8. Win7下判断当前进程是否以管理员身份运行

    判断当前程序是否以管理员身份运行,代码如下: #include <iostream> #include <windows.h> using namespace std; // ...

  9. CSS 实现垂直居中的几种方案

    最近在学关系型数据库相关,MySQL 和 Postgre,捎带着学了 PHP,为了练手这几天就忙着自己搭博客,项目部署在某云上,该云算是良心,给的空间自己搭博客用足够了.本来想着每日一bo的,所以有的 ...

  10. rubycas-client单点登录

    (文章是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) 进行中,未完待续 Ruby 客户端 使用方法0. 在 Gemfile中,加入: gem 'rubyc ...