http://sepcot.com/blog/2007/04/svn-merge-branch-trunk

SVN: Merging a Branch into Trunk

 

This is more for my benefit than anything else, but someone might find this useful.

Recently at work, I have taken on more responsibilities. Part of that includes branch control over a few web sites I work on. It took me a while to figure out how to manage everything properly and most of the stuff I found on the web wasn’t much help so I will explain it here.

The source control program I am using is SVN and the source code is stored on a server with SSH access.

MERGE A BRANCH INTO TRUNK

  1. Check out a copy of trunk:

    svn co svn+ssh://server/path/to/trunk
  2. Check out a copy of the branch you are going to merge:
    svn co svn+ssh://server/path/to/branch/myBranch
  3. Change your current working directory to “myBranch”
  4. Find the revision “myBranch” began at:
    svn log --stop-on-copy

    This should display back to you the changes that have been made back to the point the branch was cut. Remember that number (should be rXXXX, where XXXX is the revision number).

  5. Change your current working directory to trunk # Perform an SVN update:
    svn up

    This will update your copy of trunk to the most recent version, and tell you the revision you are at. Make note of that number as well (should say “At revision YYYY” where YYYY is the second number you need to remember).

  6. Now we can perform an SVN merge:
    svn merge -rXXXX:YYYY svn+ssh://server/path/to/branch/myBranch

    This will put all updates into your current working directory for trunk.

  7. Resolve any conflicts that arose during the merge
  8. Check in the results:
    svn ci -m "MERGE myProject myBranch [XXXX]:[YYYY] into trunk"

That is it. You have now merged “myBranch” with trunk.

Updated: June 18th, 2008

Steps 2-4 can be replaced by a remote log lookup:

svn log --stop-on-copy svn+ssh://server/path/to/branch

That is it. You have now merged “myBranch” with trunk.

My thanks to Samuel Wright for bringing that to my attention :-)

BONUS: CUTTING A BRANCH

Cutting a branch is a lot easier than merging a branch. And as an added bonus, I will tell you how.

  1. Perform an SVN copy:

    svn copy svn+ssh://server/path/to/trunk svn+ssh://server/path/to/branch/newBranch -m "Cut branch: newBranch"

That’s all there is to it.

转: svn合并分支到trunk的更多相关文章

  1. svn 合并分支 等

    [转载]svn分支(branch)创建.合并(到trunk).冲突解决. Leave a reply 转载自:http://zccst.iteye.com/blog/1430823 一.创建分支 1, ...

  2. svn 合并分支

    1.将某一主干/分支某一时段的改变,合并到工作空间副本 2.将某一主干/分支与其他主干/分支的改变,合并到工作空间副本

  3. svn 合并分支代码到主干

    1. eclipse 安装subclipse 2. 将主干trunk导入到eclipse中 3. 右键选择team-->合并,注意,去掉红色圈内的选项 4. next 选中select查找svn ...

  4. Eclipse SVN 合并分支/主干

    可以从主干合并到分支,也可以从分支合并到主干,根据需要可以选择合适的选项,如下图:

  5. svn合并分支到主干

    将分支pear_For2.3的最终版本合并到主干pear,操作步骤如下:1.选中主干pear右击-> Team -> 合并,弹出如下所示: 到此分支合并到主干已完成,若代码有冲突需找到冲突 ...

  6. SVN合并分支提示不是祖先关系

    开发:dev 测试:test 开发完成后,需要合并到test然后部署,进入测试. F:主干 合并到那里,那里就是主干(要合并到的分支)[起始] T:分支 从那里合并那里就是分支[结束] 备注:需要精确 ...

  7. svn打分支和合并操作

    1.svn打分支 到trunk里,选择Branch/tag.... 填写分支版本路径 到branch里svn up 一下,就有1.4.0分支了 2.svn合并 到trunk里,选择Merge.. 选择 ...

  8. svn branch and merge(svn切换分支和合并)详解

    下文的实践主要是参考了TortoiseSVN的帮助文档和Subversion的在线文档,Subversion的在线文档:http://svnbook.red-bean.com/en/1.5/svn-b ...

  9. windows 下svn 创建分支 合并分支 冲突

    我用的系统是win7+Subversion 1.7.4.服务器搭建就略过了,我也是从网上找的,基本上就是几个命令吧!我用的CentOs6.5 .网上找了几个命令搭建很快,基本上是: 1.# sudo  ...

随机推荐

  1. Redis String命令

        命令 解释 APPEND key value 如果 key 已经存在并且是一个字符串, APPEND 命令将 value 追加到 key 原来的值的末尾. 如果 key 不存在, APPEND ...

  2. 如何把car中的模块导入adams/view中

    在你的adams安装目录下的acar文件夹下找到acar.cfg文件,将里面的 MDI_ACAR_PLUS_AVIEW 后面的no改成yes,在car中的tool下面就可以找到进入view环境的命令了 ...

  3. ZOJ 3911 Prime Query ZOJ Monthly, October 2015 - I

    Prime Query Time Limit: 1 Second      Memory Limit: 196608 KB You are given a simple task. Given a s ...

  4. BZOJ3290 : Theresa与数据结构

    CANCEL操作可以看作删点,X坐标可以离散化 将询问按Z坐标差分,转化成两个求Z<=某个数的和的询问 将操作CDQ分治 每次将前一半的修改.后一半的查询按照Z坐标排序 然后扫描线,每到一个询问 ...

  5. 【BZOJ】3850: ZCC Loves Codefires(300T就这样献给了水题TAT)

    http://www.lydsy.com/JudgeOnline/problem.php?id=3850 题意:类似国王游戏....无意义.. #include <cstdio> #inc ...

  6. DWR入门教程

    DWR(Direct Web Remoting)是一个WEB远程调用框架.利用这个框架可以让AJAX开发变得很简单.利用DWR可以在客户端利用JavaScript直接调用服务端的Java方法并返回值给 ...

  7. NSCharacterSet 简单用法

    NSCharacterSet 简单用法 NSCharacterSet其实是许多字符或者数字或者符号的组合,在网络处理的时候会用到 NSMutableCharacterSet *base = [NSMu ...

  8. 初始html5,遇到的第一个问题

    1.首先感到html5是html的延续,只是增加了新的标签属性,这是我的第一感觉 2.我写了几行画矩形的canvas入门代码,遇到了不显示问题 3.下面是我写完代码后的问题 刷新后还是这样 4.我的代 ...

  9. [转]OBOUT ASP.NET HTML Editor - Insert HTML

    本文转自:http://www.obout.com/editor_new/sample_InsertHTML.aspx Example demonstrates how to access HTML ...

  10. 当Editplus遇到Java的Scanner

    学习Java编程时,我想让变量的值从键盘输入接收进来.平时在dos中运行效果很直观,那么我在Editplus这款开发工具中也可以输入,Editplus是带有控制台.当你运行Java程序时,此时出现的编 ...