irst I will make a test.txt 
首先,我创建了一个名为test.txt的文件(在svn服务器端),并录入如下内容

test

Now I will commit the changes 
现在我们提交刚刚添加的内容

C:\workspace\test>svn ci -m "making a starting point" 
Sending        . 
Sending        test.txt 
Transmitting file data . 
Committed revision 2.

Suppose we have 2 users. User1 and User2. Both of them will get and update from svn 
假设我们有用户1和用户2两个人通过svn客户端获取svn服务器端的文件test.txt

C:\workspace\test>svn up 
A    test.txt 
At revision 2.

Now User1 will change the file to: 
现在用户1更改文件test.txt内容为如下

User1 is making a conflict test

He then commits his changes 
然后用户1提交刚才的更改

C:\workspace\test>svn ci -m "User1 starting a conflict" 
Sending        . 
Sending        test.txt 
Transmitting file data . 
Committed revision 3.

User2 now comes along and changes his local copy of the file not knowing that it has already been updated by User1 on the server. 
用户2也对文件test.txt做了更改,此时他并不知道用户1做了更改并已提交。

test User2 making a conflict

When he tries to commit he will get and error from svn. 
当用户2修改文件test.txt完毕后,准备提交时出错。

svn: Commit failed (details follow): 
svn: File or directory 'test.txt' is out of date; try updating 
svn: resource out of date; try updating

So User2 performs an update 
根据错误提示,用户2更新了文件test.txt(此时发生了冲突)

C:\workspace\test>svn up 
Conflict discovered in 'test.txt'. 
Select: (p) postpone, (df) diff-full, (e) edit, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: 
svn detects that theres a conflict here and require you to take some kind of action.

If you type ‘s’ here you will get a list of the commands and meaning 
如果你输入s选项,则会列出所有svn解决冲突的选项,如下所示:

(e)  edit             - change merged file in an editor               #直接进入编辑 
(df) diff-full        - show all changes made to merged file          #显示更改至目标文件的所有变化 
(r)  resolved         - accept merged version of file

(dc) display-conflict - show all conflicts (ignoring merged version)  #显示所有冲突 
(mc) mine-conflict    - accept my version for all conflicts (same)    #冲突以本地为准 
(tc) theirs-conflict  - accept their version for all conflicts (same) #冲突以服务器为准

(mf) mine-full        - accept my version of entire file (even non-conflicts)#完全以本地为准 
(tf) theirs-full      - accept their version of entire file (same)    #完全以服务器为准

(p)  postpone         - mark the conflict to be resolved later        #标记冲突,稍后解决 
(l)  launch           - launch external tool to resolve conflict 
(s)  show all         - show this list

【选择处理方式一:df】

If you type ‘df’ it will show you a all the conflicts in the following format 
选择选项df,则会按如下格式显示所有冲突

Select: (p) postpone, (df) diff-full, (e) edit, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: df 
--- .svn/text-base/test.txt.svn-base    Tue Aug 10 10:59:38 2010 
+++ .svn/tmp/test.txt.2.tmp     Tue Aug 10 11:33:24 2010 
@@ -1 +1,3 @@ 
-test 
\ No newline at end of file 
+<<<<<<< .mine +test User2 making conflict======= +User1 is making a conflict test>>>>>>> .r3 
‘e’ option will open the conflicted file in the text editor that you configured for svn to use. In this case it will show

<<<<<<< .mine test User2 making conflict======= User1 is making a conflict test>>>>>>> .r3

You can resolve the conflict here by changing the text to what you desire. 
For example: 
你可以解决冲突通过改变文件内容,例如vim test.txt

User1 is making a conflict test User2 making conflict

save your changes and exit your text editor and it will give you the conflict options again. Now if you use the ‘r’ it will mark the file is merged with a ‘G’.  A status of ‘G’ means there was a conflict and it has been resolved. 
保存更改,又出现刚才的选项。此时你使用r选项,则会合并文件。如下所示:

Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: e 
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: r 
G    test.txt 
Updated to revision 3.

you can now check the status with svn status. You see that test.txt is marked as ‘M’ all thats left to do is commit. 
检查svn状态,你会发现文件test.txt前面已变成M

C:\workspace\test2>svn st 
M       test.txt

C:\workspace\test2>svn ci -m "conflict resolved" 
Sending        test.txt 
Transmitting file data . 
Committed revision 4.

【选择处理方式二:p】

Sometimes the conflicts are a bit more extensive and it requires more time or better tools to resolve the conflict in these cases you can chose ‘p’ to postpone the resolution. 
有时,冲突会复杂一些,可能需要借助其他工具才能解决,这时你可以使用选项p

Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: p 
C    test.txt 
Updated to revision 3. 
Summary of conflicts: 
  Text conflicts: 1

Now if you look in your directory you will see that svn has created a few extra files for you. 
此时,查看当前文件夹下,出现了如下几个文件

08/10/2010  11:44 AM                94 test.txt 
08/10/2010  11:44 AM                26 test.txt.mine 
08/10/2010  11:44 AM                27 test.txt.r2 
08/10/2010  11:44 AM                31 test.txt.r3

The test.txt file is now a file with both User2 and User1′s changes but marked. 
文件test.txt包含了用户1和用户2的更改。

<<<<<<< .mine test User2 making conflict======= User1 am making a conflict test>>>>>>> .r3

test.txt.mine is User2′s copy. 
文件.txt.mine保存了用户2的内容

test User2 making conflict

test.txt.r2 is the original base copy 
文件.txt.r2是未冲突前的内容

test

test.txt.r3 is the copy User1 commited 
文件.txt.r3保存了用户1的内容

User1 is making a conflict test

At this point you can choose your favorite merge tools to merge the differences in a file. 
这种情况下,你可以选择自己喜欢的对比工具,查看差别。

I suggest merging the differences into test.txt and the do a 
我建议和并不同至文件test.txt中,如果如下命令:

C:\workspace\test>svn resolve --accept working test.txt

Resolved conflicted state of 'test.txt'

You can also use any of the other files if you wanted to and just pass resolve –accept a different argument. Here are the valid arguments 
当然,你也可以使用其他文件,使用resolve -accept 加其他参数,共6个

实例: 
svn resolve mail.sh --accept 'mine-conflict'     #解决冲突。 
svn resolved mail.sh                                          #告知svn。4个文件中的其他3个消失

(1)#svn resolve –accept base 
Choose the file that was the BASE revision before you updated your working copy. That is, the file that you checked out before you made your latest edits. 
使用1.txt.r2作为最后提交的版本

(2)#svn resolve –accept working 
Assuming that you've manually handled the conflict resolution, choose the version of the file as it currently stands in your working copy. 
使用当前拷贝即test.txt作为最后提交的版本

(3)#svn resolve –accept mine-full 
Resolve all conflicted files with copies of the files as they stood immediately before you ran svn update. 
使用test.txt.mine作为最后提交的版本

(4)#svn resolve –accept theirs-full 
Resolve all conflicted files with copies of the files that were fetched from the server when you ran svn update. 
使用test.txt.r3作为最后提交的版本

(5)#svn resolve –accept mine-conflict 
冲突的部分以本地修改为准

(6)#svn resolve –accept theirs-conflict 
冲突的部分以服务器端修改为准

执行一下:svn resolved test.txt。

Now you are ready to commit. 
然后提交

C:\workspace\test>svn ci -m "conflict resolved" 
Sending        test.txt 
Transmitting file data . 
Committed revision 4.

本文出自http://zccst.iteye.com/blog/1765519

转载于:https://blog.51cto.com/lookingdream/1882224

[svn] 解决SVN冲突攻略(手册)相关推荐

  1. CV:Visual Studio 2015版本+CUDA8.0+Cudnn8.0+OpenCV 3.1.0版本完美解决的详细攻略

    CV:Visual Studio 2015版本+CUDA8.0+Cudnn8.0+OpenCV 3.1.0版本完美解决的详细攻略 导读:网上教程一大把,瞎指挥的不少,剪不断理还乱,可气的事,还误人子弟 ...

  2. 计算机无法外接投影,投影仪不能连接电脑了如何解决?教程攻略

    原标题:投影仪不能连接电脑了如何解决?教程攻略 投影仪近几年一直是我们关注的焦点,随着科技的发展投影仪的功能也越来越多元化,投影仪的投影功能也已经成为了日常生活和商务办公必不可少的,平常我们看个资源比 ...

  3. SVN的安装和介绍以及SVN的配置和使用(包含IDEA集成SVN、SVN解决版本冲突问题)

    文章目录 1. SVN介绍 1.1 SVN简介 1.2 SVN主要作用 1.3 基本概念 1.4 工作流程 1.5 生命周期 1.5.1 创建版本库(Create) 1.5.2 检出(Checkout ...

  4. ro素质点模拟器_仙境传说RO:最具人气职业猎人成长攻略手册

    <仙境传说RO>在6月底开启了全新的版本EP6.0<光影之都>,除了新的剧情外宠物外观等等外,还拓展了一个新的职业分支:初心者.至此,<仙境传说RO>中又多了一个职 ...

  5. idea 2022版本整合svn解决代码冲突问题

    idea 2022版本无法像idea 2018版本在更新代码时直接弹出合并窗口 1,更新代码 2,合并冲突 合并代码的弹出框

  6. 永恒之柱2显示服务器,永恒之柱2游戏黑屏是什么原因怎么解决_画面显示不全解决方法教程攻略...

    IGN给出了最近发售的<永恒之柱2>8.5分的评价,称游戏中出色地塑造了不少人物形象,也拥有着迷人的海岛景色,虽然略有瑕疵,仍然不失为一款佳作. <永恒之柱2:死亡之火>在&l ...

  7. 【讲座笔记】商业分析全攻略手册

    [商业分析]1-如何用7+2步解决问题 如何用7+2步解决问题,麦肯锡七步成诗法 0. 思考问题动因 思考动因要了解客户.老板的需求 界定问题 问题的最终界定必须明确且可执行,清晰的界定问题有助于建立 ...

  8. Android仿qq网络不给力,《天天酷跑》qq授权失败网络不给力?解决_图文攻略_高分攻略_百度攻略...

    问:天天酷跑qq授权失败网络不给力?有神门解决办法 答:其实这个问题小编是没有出现过,大部分情况是因为网速的原因,然后小编重新登录一下一般就可以了,不知道小伙伴们为什么会一直显示qq授权失败网络不给力 ...

  9. ff14显示连接备份服务器失败,备份失败怎么办 备份失败有什么办法解决 备份失败攻略...

    ff14角色备份失败可以将档案路径为:「游戏根目录\FFXIV\game\My Games\FINAL FANTASY XIV - A Realm Reborn」的整个资料夹,整个备份就行了. 详细答 ...

最新文章

  1. 三万字,Spark学习笔记
  2. Quora Question Pairs 项目参考资料
  3. [转]expect实现ssh自动交互
  4. kalman滤波的解释
  5. Python学习3 字符串和相关常用函数
  6. 如何在苹果官网下载旧版本的Xcode 方法
  7. 十步教你成为数据科学家!
  8. 互联网核心应用(搜索/推荐/广告)算法峰会
  9. android 万能播放器
  10. 二十套Java项目源码
  11. redis 菜鸟教程
  12. 复杂性应对之道 - 领域建模
  13. 一种基于A* 算法的动态多路径规划算法
  14. 微信公众号菜单模板设置
  15. kubeadm,kubevip,containerd部署高可用的kubernetes集群
  16. 锐意创新,引领音视频未来
  17. 广义相对论-学习记录5-第三章-张量分析与黎曼几何2
  18. 记录:起个撒名了, 就叫 《方向》 吧....
  19. Shell脚本中的循环
  20. 笨木头的跑跑跑笔记三 精灵的运动动画

热门文章

  1. UIView中常见的方法汇总
  2. 深入理解JVM读书笔记--Class文件结构
  3. .NET 3.5(14) - XLINQ(LINQ to XML)之针对XML文件的添加、查询、更新和删除
  4. Seata-Server安装_以及工作原理---微服务升级_SpringCloud Alibaba工作笔记0058
  5. C#串口通信工作笔记0001---嵌入式_串口通信_数据发送
  6. linux shell 读取for循环中出现难处理的数据之单引号错误实例
  7. java 正则表达式 table_JavaEdge/Java/Java中正则表达式.md at master · VegTableBird/JavaEdge · GitHub...
  8. 一步一步写算法(之prim算法 下)
  9. 一步一步写算法(之排序二叉树线索化)
  10. python不变的数据结构是_Python cookbook(数据结构与算法)从序列中移除重复项且保持元素间顺序不变的方法...