ITPub博客

首页 > 架构设计 > 软件结构 > 11.java版spring cloud+spring boot 之SVN分支

11.java版spring cloud+spring boot 之SVN分支

原创 软件结构 作者:JIAN2 时间:2021-11-10 14:43:34 0 删除 编辑

 SVN分支


Branch 选项会给开发者创建出另外一条线路。当有人希望开发进程分开成两条不同的线路时,这个选项会非常有用。

比如项目 demo 下有两个小组,svn 下有一个 trunk 版。

需要框架源码的朋友可以看我个人简介联系我

推荐分布式架构 源码

 由于客户需求突然变化,导致项目需要做较大改动,此时项目组决定由小组 1 继续完成原来正进行到一半的工作(某个模块),小组 2 进行新需求的开发。

那么此时,我们就可以为小组2建立一个分支,分支其实就是 trunk 版(主干线)的一个copy版,不过分支也是具有版本控制功能的,而且是和主干线相互独立的,当然,到最后我们可以通过(合并)功能,将分支合并到 trunk 上来,从而最后合并为一个项目。

我们在本地副本中创建一个  my_branch 分支。

root@xxxxxx:~/svn/xxxxxx01# ls
branches  tags  trunk
root@xxxxxx:~/svn/xxxxxx01# svn copy trunk/ branches/my_branch
A         branches/my_branch
root@xxxxxx:~/svn/xxxxxx01#

查看状态:

root@xxxxxx:~/svn/xxxxxx01# svn status
A  +    branches/my_branch
A  +    branches/my_branch/HelloWorld.html
A  +    branches/my_branch/readme

提交新增的分支到版本库。

root@xxxxxx:~/svn/xxxxxx01# svn commit -m "add my_branch" 
Adding         branches/my_branch
Replacing      branches/my_branch/HelloWorld.html
Adding         branches/my_branch/readme
Committed revision 9.

接着我们就到 my_branch 分支进行开发,切换到分支路径并创建 index.html 文件。

root@xxxxxx:~/svn/xxxxxx01# cd branches/my_branch/
root@xxxxxx:~/svn/xxxxxx01/branches/my_branch# ls
HelloWorld.html  index.html  readme

将 index.html 加入版本控制,并提交到版本库中。

root@xxxxxx:~/svn/xxxxxx01/branches/my_branch# svn status
?       index.html
root@xxxxxx:~/svn/xxxxxx01/branches/my_branch# svn add index.html 
A         index.html
root@xxxxxx:~/svn/xxxxxx01/branches/my_branch# svn commit -m "add index.html"
Adding         index.html
Transmitting file data .
Committed revision 10.

切换到 trunk,执行 svn update,然后将 my_branch 分支合并到 trunk 中。

root@xxxxxx:~/svn/xxxxxx01/trunk# svn merge ../branches/my_branch/
--- Merging r10 into '.':
A    index.html
--- Recording mergeinfo for merge of r10 into '.':
 G   .

此时查看目录,可以看到 trunk 中已经多了 my_branch 分支创建的 index.html 文件。

root@xxxxxx:~/svn/xxxxxx01/trunk# ll
total 16
drwxr-xr-x 2 root root 4096 Nov  7 03:52 ./
drwxr-xr-x 6 root root 4096 Jul 21 19:19 ../
-rw-r--r-- 1 root root   36 Nov  7 02:23 HelloWorld.html
-rw-r--r-- 1 root root    0 Nov  7 03:52 index.html
-rw-r--r-- 1 root root   22 Nov  7 03:06 readme

将合并好的 trunk 提交到版本库中。

root@xxxxxx:~/svn/xxxxxx01/trunk# svn commit -m "add index.html"
Adding         index.html
Transmitting file data .
Committed revision 11.



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70006413/viewspace-2841513/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
华为资深架构师,曾参与华为数据中心迁移解决方案!有需要了解分布式微服务电商源码的朋友可以+我 v ❤: haiwabbc2 , 10余年互联网研发行业经验!博客里面是个人的一点技术总结,希望能够帮助到更多的IT朋友成长!

注册时间:2021-09-06

  • 博文量
    1404
  • 访问量
    623304