用SVN进行团队开发协作生命周期详解

用SVN进行团队开发协作生命周期详解

目录

  • 1. 前言
  • 2. 面向人群
  • 3. 背景
  • 4. 解决方案
  • 5. 团队开发生命周期
    • 5.1. 创建新项目
    • 5.2. 创建分支
    • 5.3. 切换分支
    • 5.4. 合并代码
    • 5.5. 正式版本发布
    • 5.6. bug修复
  • 6. 结束语

前言

查找了SVN的相关知识无论是园子里还是百度都只有一些理论,而有实践教程的都是点到为止,并没有一个完整的关于团队如何使用SVN协同工作的教程,因此写下该篇希望能对大家起到一点帮助。

面向人群

本教程面向有一定svn基础的,而且之前都是单人开发,对团队开发如何使用SVN并不了解,但急需了解的的同学。

背景

由于团队开发是如果没有正确的使用SVN经常出现A在做一个需求涉及到a,b项目,而B再做另一个项目涉及到a,c项目。
然后A做完了直接提交了代码,但是并未经过测试。B的代码测试完毕然后提交准备投产,然后发现A已经提交了代码,所以他就获取了A的代码,编译后如果不询问A是否代码经过测试,可能直接投产了,然后投产出现了问题。或者知道了A的代码还未测试,必须等测试通过后才能投产。否则只能恢复到测试完的代码进行投产。最后甚至有可能就忘记提交了。

解决方案

规定代码必须经过测试后才能提交,这一定程度上解决了这个问题,但是这就偏离了版本控制的初衷而且每次开发代码必须一次性开发完成,若开发中途发现问题,导致一部分代码需要重打,那么就不能很好的回滚。

团队开发生命周期

创建新项目

以下操作都是使用VS的VisualSVN插件,其他插件使用方法都是差不多的,在文件资源管理器中使用方法原理是一样的。

首先针对我们的SVNTest1项目

id="iframe_0.507204060908407" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2Ffdfc565cbd1507c6.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.507204060908407" frameborder="0" scrolling="no" height="180" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  1. 在项目右击菜单中将整个项目加入到SVN中

    id="iframe_0.07332807616330683" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F7ff7164a615dfa70.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.07332807616330683" frameborder="0" scrolling="no" height="383" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  2. 首选选择需要加入的根目录点击下一步

    id="iframe_0.07176448265090585" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F7eb531f3e0dfe0ee.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.07176448265090585" frameborder="0" scrolling="no" height="453" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  3. 新项目选择新建仓库,若已经在SVN服务器创建目录接口就选择添加存在项目

    id="iframe_0.8905712720006704" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F9f907186076e2241.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8905712720006704" frameborder="0" scrolling="no" height="453" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  4. 选择SVN的路径

    id="iframe_0.8880290410015732" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fd783cd7f77d5d489.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8880290410015732" frameborder="0" scrolling="no" height="453" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.16892718337476254" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F095a46e66253f441.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.16892718337476254" frameborder="0" scrolling="no" height="453" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    在svn中我们创建的仓库下包含trunk,branches和tags三个文件夹,trunk为主线,branches为分支而tags则是标签
    trunk:用于存放主线代码,我们不能在这里进行开发
    branches:用于并行开发使用,每个需求或者bug修复都需要创建一个分支
    tags:这里的代码不能编辑,只可读取,每隔标志性版本我们可以在tags中创建一个标签,如V1.0正式版,那么当代码合并到trunk后可以创建一个标签,如果接下来开发v2.0版本,而突然发现v1.0有个bug,就可以将次代码创建一个新分支用于修复bug,修复完成后可以合并到主线任务中并创建v1.1标签
    我们可以使用2种结构开发我们的项目,第一种是每个项目文件夹下创建这三个目录,然后进行开发;第二种方式在根目录下就创建三个文件夹,然后在这三个文件夹下有多个项目。这里我用第一种方式,两种方式只是结构不同,原理一样的

  5. 如果需要验证输入用户名和密码,然后点击导入,新项目就导入成功

    id="iframe_0.7780645731836557" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F087c7f49b5806345.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7780645731836557" frameborder="0" scrolling="no" height="453" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.4847281516995281" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F21eb86bc959db373.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4847281516995281" frameborder="0" scrolling="no" height="453" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  6. 导入成功只是在我们本地SVN缓存中导入成功,我们必须提交到服务器中

    id="iframe_0.8229707113932818" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fcbb0e7bc30bf5448.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8229707113932818" frameborder="0" scrolling="no" height="210" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.23790993820875883" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F339f20dbb877ec51.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.23790993820875883" frameborder="0" scrolling="no" height="166" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.5594599491450936" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F1ff37f9b54e801be.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5594599491450936" frameborder="0" scrolling="no" height="105" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  7. 我们可以将bin和obj这些目录忽略掉,否则每次编译提交后他人更新都会有冲突,在VisualSVN插件提交默认已经忽略了这两个目录因此直接提交即可。

    id="iframe_0.917266797972843" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fa34c58da5a7fba3e.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.917266797972843" frameborder="0" scrolling="no" height="572" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.20002428954467177" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F7278eb691ec8a54c.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.20002428954467177" frameborder="0" scrolling="no" height="523" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.4724438551347703" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fe5d47a4b8a7317d0.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4724438551347703" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.19558846508152783" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F87ec2f37177d5b5a.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.19558846508152783" frameborder="0" scrolling="no" height="252" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

创建分支

现在主线已经创建好了 ,如果我们要进行开发或者修复bug,请不要在主线上面开发,我们必须先创建分支,然后再分支上进行开发,这样就不会影响到主线的代码,当分支开发完成并测试通过后可以合并到主线,同时若分支没用即可删除。

id="iframe_0.5664421219844371" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2Ffc07ab83f7262c52.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5664421219844371" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

在工具栏中有常用的按钮,方便我们使用,如果使用其他SVN插件也是类似的,我们也可以直接在项目右击进行操作

id="iframe_0.9087326962035149" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F846d28c7da29c2d9.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.9087326962035149" frameborder="0" scrolling="no" height="209" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

不知为何在菜单中没有创建分支选项,我们直接在工具栏中创建,在文件夹右击创建分支也是一样的

id="iframe_0.4121172053273767" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F94417c0737bd9230.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4121172053273767" frameborder="0" scrolling="no" height="422" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
id="iframe_0.5820422121323645" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F4d048f2cca05b129.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5820422121323645" frameborder="0" scrolling="no" height="583" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

如果否选切换工作副本至新分支,那么创建完会自动切换,如果没有钩,那么我们还是在原来的主线,我们暂时不勾选手动切换分支

id="iframe_0.13681561243720353" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F8738c21c84039558.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.13681561243720353" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

创建完成由于我们没有勾选自动切换,svn就提示了我们手动切换,同时SVN服务器中也有了新的分支

id="iframe_0.8498955583199859" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F40e56c3073eb3ef3.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8498955583199859" frameborder="0" scrolling="no" height="221" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

切换分支

id="iframe_0.4467506995424628" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F043af865550e09d4.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4467506995424628" frameborder="0" scrolling="no" height="264" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

默认只有主线,这里我们选择切换到其他分支

id="iframe_0.07909896573983133" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fd56d3510868bbf47.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.07909896573983133" frameborder="0" scrolling="no" height="406" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
id="iframe_0.04897631308995187" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F2cb0d61e424de14f.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.04897631308995187" frameborder="0" scrolling="no" height="219" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
id="iframe_0.8689060872420669" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F69dfb2955d8fc2c9.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8689060872420669" frameborder="0" scrolling="no" height="121" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

现在我们已经切换到新的v0.1的分支了,现在假设person2同学需要对对该项目进行同步开发,因此我们希望每个人能区分开来,我们可以将项目根据人来区分,如/Test/branches/person1/v0.1,/Test/branches/person1/v0.1-bug1,/Test/branches/person2/v0.1等,也可以根据项目来区分,如如/Test/branches/v0.1/person1/xxx,/Test/branches/v0.1/person1/fix-bug1,/Test/branches/v0.1/person2`等。只要决定一个规范既可。

  1. 现在我们约定以/Test/branches/v0.1/person1的方式来存放,那么首先person1可以创建一个新的分支进行开发。

    id="iframe_0.21707506501115859" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F3e3328fabe13d45e.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.21707506501115859" frameborder="0" scrolling="no" height="52" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  2. 模拟person2同学并行开发,由于B同学需要获取全新的项目,因此需要首先从版本库中获取该项目

    id="iframe_0.03879121202044189" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F93290cb892bd68f8.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.03879121202044189" frameborder="0" scrolling="no" height="605" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.4045182727277279" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F0c24542a9ef87a2e.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4045182727277279" frameborder="0" scrolling="no" height="311" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.3349552054423839" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F373b72570969f467.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.3349552054423839" frameborder="0" scrolling="no" height="231" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    现在B同学需要创建一个新的分支到person2目录

    id="iframe_0.1818795169238001" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Fbaf7215c46c3bc9a.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.1818795169238001" frameborder="0" scrolling="no" height="247" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    此时目录结构如图所示,为了避免干扰项,我已从svn服务器删除了第一个创建的分支

    id="iframe_0.19936823891475797" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Ffeea36c17c9f34ad.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.19936823891475797" frameborder="0" scrolling="no" height="620" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  3. 现在person1和person2可以独立进行开发并提交代码到自己的分支上而不会影响主线,更不会影响其他人的开发了

    • person1添加了一个文件1.cs

    id="iframe_0.44014236656948924" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F20da605594e02bbe.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.44014236656948924" frameborder="0" scrolling="no" height="164" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.7749052240978926" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F05f2ed24cf798bf2.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7749052240978926" frameborder="0" scrolling="no" height="523" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.610345519380644" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F1be57fd732d777fb.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.610345519380644" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    • person2添加了一个文件2.cs

    id="iframe_0.5767491848673671" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fa80fc03b738ecf80.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5767491848673671" frameborder="0" scrolling="no" height="194" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.72611860698089" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F7ef7e468a470dde0.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.72611860698089" frameborder="0" scrolling="no" height="523" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.8270613651257008" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2Fafbe25721a0ee418.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8270613651257008" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    我们发现他们可以正常提交而无需更新,因为实际他们是在不同的分支工作,当然不会产生影响

合并代码

假设person1已经开发完成并通过测试需要将分支合并到主线
  1. 切换到主线

    id="iframe_0.03539323271252215" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F6e6206e2eac6069f.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.03539323271252215" frameborder="0" scrolling="no" height="142" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  2. 点击合并

    id="iframe_0.22148090414702892" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F79d096deaba5e616.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.22148090414702892" frameborder="0" scrolling="no" height="538" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.04289116756990552" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F6d8ecd23c13faf2c.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.04289116756990552" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.13680736045353115" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F68745c308af9b958.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.13680736045353115" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.42645198525860906" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Fafb26f400c4e4ddb.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.42645198525860906" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    到此为止已经将分支合并到我们的主线,但是这里的主线只是我们本地的主线(svn会将分支保存到不同的目录,因此我们本地不同分支会存放在不同的临时目录的,在svn文件夹下,不要手动去修改该目录)

    id="iframe_0.7035537329502404" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F1ff37f9b54e801be.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7035537329502404" frameborder="0" scrolling="no" height="105" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  3. 将本地主线提交到服务器

    id="iframe_0.1643203201238066" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F521f9a0837c68163.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.1643203201238066" frameborder="0" scrolling="no" height="265" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    我们可以看到合并到主线后,我们的解决方案管理器有些黄色的圆点代表修改,我们看下svn服务器

    id="iframe_0.6422996509354562" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F45d96a0173963dc6.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.6422996509354562" frameborder="0" scrolling="no" height="735" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    发现我们虽然提交了代码实际服务器主线还并没有1.cs文件

    id="iframe_0.5015935546252877" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F3ca58613f65537ec.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5015935546252877" frameborder="0" scrolling="no" height="523" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.7887600876856595" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2Fd6d0140608328838.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7887600876856595" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.4325496549718082" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F0aa8d1b189a1315a.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4325496549718082" frameborder="0" scrolling="no" height="735" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    提交成功后发现svn服务器主线已经有该文件

    4. person2已经开发完成并通过测试需要将分支合并到主线

    5. person2需要切换到主线

    id="iframe_0.9293101031798869" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F7a7f8a8c5fd55d45.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.9293101031798869" frameborder="0" scrolling="no" height="99" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    6. 切换完点击合并

    id="iframe_0.5067163575440645" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F79d096deaba5e616.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5067163575440645" frameborder="0" scrolling="no" height="538" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.3066984163597226" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F3f79daf2f25344c3.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.3066984163597226" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.6952212613541633" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F68745c308af9b958.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.6952212613541633" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.9180514223407954" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F09cc13baf36ed073.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.9180514223407954" frameborder="0" scrolling="no" height="473" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    会发先有冲突,因为person1已经提交了代码,而你本地的代码并不是最新代码,所以合并之前先将主线代码合并到分支,然后分支解决冲突后提交到服务器分支。再重新切换到主线进行分支合并,此时完整的流程即走完

  4. 以上3个步骤忽略,不要直接切换主线,而是提交代码前先保证分支代码最新,首先将主线合并到分支

    id="iframe_0.5434050085023046" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2Fe6538c91a0236351.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5434050085023046" frameborder="0" scrolling="no" height="245" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.6823807174805552" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F80a53d917836c741.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.6823807174805552" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.3355358773842454" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F75d065e109836b39.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.3355358773842454" frameborder="0" scrolling="no" height="307" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  5. 解决冲突后,即可提交代码

    id="iframe_0.7127358382567763" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F8f8d6d82d1a4df0f.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7127358382567763" frameborder="0" scrolling="no" height="277" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    代码还未提交时SVN服务器person2目录实际还没有1.cs文件

    id="iframe_0.4839935644995421" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F9b57762bda29db92.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4839935644995421" frameborder="0" scrolling="no" height="735" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    提交代码后就有了

    id="iframe_0.5994324621278793" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Ff71ad10a843f6d8a.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.5994324621278793" frameborder="0" scrolling="no" height="735" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  6. 合并分支到主线

    id="iframe_0.7887943536043167" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F79d096deaba5e616.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7887943536043167" frameborder="0" scrolling="no" height="538" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.009689918486401439" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F3f79daf2f25344c3.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.009689918486401439" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.9156565936282277" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F68745c308af9b958.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.9156565936282277" frameborder="0" scrolling="no" height="595" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.16160089592449367" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F47426088f050bf94.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.16160089592449367" frameborder="0" scrolling="no" height="460" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  7. 提交主线代码

    id="iframe_0.7300104678142816" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2Fae51c1efd41216c5.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7300104678142816" frameborder="0" scrolling="no" height="735" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    由于person1并未获取person2的代码因此person1实际只有1.cs,而person2由于在person1提交的代码后更新了主线代码,因此perosn2有1.cs和2.cs

正式版本发布

版本发布只针对trunk的目录进行发布
现在开发任务已经完成,我们认为这个版本已经很成熟,我们希望把这个版本定为v1.0,我们现在可以删除分支,同时将该版本打个标记

  1. 删除分支

    直接删除无用分支即可
    id="iframe_0.8674183038529009" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F5e6947f63c25faa9.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.8674183038529009" frameborder="0" scrolling="no" height="395" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  2. 做v1.0的标记

    标记其实就是一个分支,只不过tags文件夹应该设置为只读权限

    id="iframe_0.7181886043399572" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F58bd76416c995954.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7181886043399572" frameborder="0" scrolling="no" height="507" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

    切换到主线切出一个tags

    id="iframe_0.12184830219484866" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi3.piimg.com%2F2038c966a8c6cfeb.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.12184830219484866" frameborder="0" scrolling="no" height="583" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.9985880274325609" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F0d6c01422e0dd0b9.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.9985880274325609" frameborder="0" scrolling="no" height="302" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

bug修复

现在我们可能在开发2.*的版本了,突然发现1.0的版本有bug

  1. 从tags/v1.0版本中切除一个分支修复bug

    id="iframe_0.4477321691811085" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Fbe7b29eab28821e2.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4477321691811085" frameborder="0" scrolling="no" height="583" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.7274274204391986" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F6534f0a9c2c72486.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7274274204391986" frameborder="0" scrolling="no" height="460" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  2. 修复bug后做一个v1.1的tags,或者根据情况合并当trunk

    id="iframe_0.4515517703257501" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Ff57644fbc8e55d9e.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4515517703257501" frameborder="0" scrolling="no" height="460" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.43182261078618467" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2Fd513e9d894eabced.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.43182261078618467" frameborder="0" scrolling="no" height="460" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

  3. 修复bug后合并到trunk分支

    id="iframe_0.630977455759421" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F90c4c99c87ae97f4.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.630977455759421" frameborder="0" scrolling="no" height="523" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.4391423335764557" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F6fcc73198b8d9f20.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.4391423335764557" frameborder="0" scrolling="no" height="460" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">
    id="iframe_0.7360051926225424" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi4.piimg.com%2F33e3ce82a4687f3e.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.7360051926225424" frameborder="0" scrolling="no" height="404" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

结束语

至此整个团队开发生命周期就讲解完毕,接下来就是不断佚代的过程。
以上是我个人理解,如果看来此篇文章略有所学,请支持下,如若有误烦请指正,。

PS: 第一次用vs code编写,还是挺好用的(●ˇ∀ˇ●)
id="iframe_0.06435651215724647" src="https://www.cnblogs.com/show-blocking-image.aspx?url=http%3A%2F%2Fi2.piimg.com%2F70fec18ff5d3ffc3.png&maxWidth=848&origin=http://www.cnblogs.com&iframeId=iframe_0.06435651215724647" frameborder="0" scrolling="no" height="457" style="margin: 0px; padding: 0px; border-style: none; border-width: initial; width: 848px;">

你可能感兴趣的:(SVN)