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. MAXIMO移动解决方案在库存管理中的PDA应用系统

    随着无线网络通信技术.掌上电脑技术以及条形码自动识别技术的推广使用,为了强化MAXIMO系统库存管理的功能,着手开发MAXIMO移动应用解决方案. 该解决方案集成了无线局域网络通信.掌上电脑以及条形码 ...

  2. Linux部署项目简要记录【只是步骤没有配图】

    1.服务器(192.168.1.197)新建数据库jspxcms_1206,导入数据2.eclipse打war包3.上传war包到/home/app/apache-tomcat-7.0.68/weba ...

  3. DFS POJ 2676 Sudoku

    题目传送门 题意:数独问题,每行每列以及每块都有1~9的数字 分析:一个一个遍历会很慢.先将0的位子用vector存起来,然后用rflag[i][num] = 1 / 0表示在第i行数字num是否出现 ...

  4. DataGrid排序

    DataGrid是ASP.NET中非常重要的一个控件.它能方便的让我们实现编辑.排序功能:但是排序功能默认的是升序(ASC),能不能让DataGrid同时实现升降序排列呢?这篇文章将给你一个比较好的解 ...

  5. BZOJ4304 : 道路改建

    首先求出SCC,把图缩点成一个DAG. 通过拓扑排序+DP求出: dp0[x]:从x点出发能到的点的集合. dp1[x]:能到x的点的集合. 对于一条边x->y,将它改为双向边后,形成的新的SC ...

  6. 用C语言实现素数筛法获取一亿(100000000)以内的全部素数

    具体筛法是:先把n个自然数按次序排列起来.1不是质数,也不是合数,要划去.第二个数2是质数留下来,而把2后面所有能被2整除的数都划去.2后面第一个没划去的数是3,把3留下,再把3后面所有能被3整除的数 ...

  7. 过滤html字符的方法

    昨天在看公司网站的产品详细页面,发现只有一个公司的JS产品轮换特效不会出,找了半天,程序都是一样的,原因是什么呢?原来是公司的别名是xiandahg,里面含有and字符被过滤掉了. public st ...

  8. MySQL 用户管理——权限表

    权限表 权限表存放在mysql数据库中 user表结构 用户列:Host.User.Password 权限列:*priv 资源控制列:max* 安全列:其余   db表 存储了用户对某个数据库的操作权 ...

  9. placeholder在不同浏览器下的表现及兼容方法

    1.什么是placeholder?    placeholder是html5新增的一个属性,当input或者textarea设置了该属性后,该值的内容将作为灰字提示显示在文本框中,当文本框获得焦点(或 ...

  10. 你能不用计算机来计算S=a+(a+1)+(a+2) + ...... + b的解的数目吗?

    S=a + (a + 1) + (a + 2) + ...... + b(其中a, b > 0) 现在我们要求,给定一个正整数S,求有多少种不同的<a,b>,使得上述的等式成立. 这 ...