svn update test.txt
6)删除文件:
svn delete test.txt
7)再次svn服务器文件列表:
PS D:\workspace\xiaohui\test_oa> svn list svn://localhost:8888/test_oa
发现test.txt文件依旧存在
8)提交删除操作:
svn commit -m “删除test.txt” test.txt
9)此时查看svn服务器文件列表发现test.txt不存在了
10)xiaolan用户更新当前文件夹(会发现删除了test.txt)
svn update test_oa
### 1.3 冲突
#### 1.3.1 旧版本冲突
**我们在提交前,必须保证当前版本是最新的版本,不可使用旧版本提交;**
##### 1)演示冲突
* 案例:
1)xiaohui在hello.txt文件中编辑某行记录,文件内容如下:
11111aaa
22222
33333
44444
2)然后提交:
PS D:\workspace\xiaohui\test_oa> svn commit -m “xiaohui update” hello.txt
Sending hello.txt
Transmitting file data .done
Committing transaction…
Committed revision 3.
PS D:\workspace\xiaohui\test_oa>
![在这里插入图片描述](https://img-blog.csdnimg.cn/6ca1d3a1f6ac404e88ad9aaf5e387ac9.png#pic_center)
>
> 文件版本已经更新到了3;
>
>
>
3)xiaolan也在hello.txt文件中编辑某行记录,文件内容如下:
11111
22222bbb
33333
44444
4)然后提交(**注意:没有更新到最新版本,此时文件版本还是2**)
PS D:\workspace\xiaolan\test_oa> svn commit -m “xiaolan update” hello.txt
Sending hello.txt
Transmitting file data .done
Committing transaction…
svn: E160028: Commit failed (details follow):
svn: E160028: File ‘/hello.txt’ is out of date
![在这里插入图片描述](https://img-blog.csdnimg.cn/a0a5b32003b546a38c55e9944fc13349.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
>
> 出现错误,使用了过时的版本提交;
>
>
>
##### 2)解决冲突
我们在提交代码时,必须保证我们当前代码的版本是最新的才能提交;
1)首先更新一下代码,保证代码是最新的:
PS D:\workspace\xiaolan\test_oa> svn update hello.txt
Updating ‘hello.txt’:
G hello.txt
Updated to revision 3.
查看文件内容:
![在这里插入图片描述](https://img-blog.csdnimg.cn/41ffe7c61b014e4f92cb0aa4c0553199.png#pic_center)
2)再进行提交
PS D:\workspace\xiaolan\test_oa> svn commit -m “xiaolan update” hello.txt
Sending hello.txt
Transmitting file data .done
Committing transaction…
Committed revision 4.
![在这里插入图片描述](https://img-blog.csdnimg.cn/bb0fad51ed8d43fd85b6d4d01a0e151f.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
#### 1.3.2 代码编辑冲突
在"旧版本编辑冲突"案例中,xiaohui和xiaolan两个用户编辑的不是同一行记录,万一两个用户编辑的是同一行记录,那么这个时候就会出现代码编辑冲突
##### 1)演示冲突
首先将xiaohui的hello.txt更新到最新版本:
PS D:\workspace\xiaohui\test_oa> svn update hello.txt
Updating ‘hello.txt’:
U hello.txt
Updated to revision 4.
1)xiaohui编辑hello.txt文件如下:
11111aaa
22222bbb
33333ccc
44444
2)xiaohui提交hello.txt文件:
PS D:\workspace\xiaohui\test_oa> svn commit -m “xiaohui修改第三行数据” hello.txt
Sending hello.txt
Transmitting file data .done
Committing transaction…
Committed revision 5.
>
> 此时文件的版本变为了5
>
>
>
3)xiaolan编辑hello.txt文件如下:
11111aaa
22222bbb
33333ddd
44444
提交前首先更新到最新版本:
PS D:\workspace\xiaolan\test_oa> svn update hello.txt
Updating ‘hello.txt’:
C hello.txt
Updated to revision 5.
Summary of conflicts:
Text conflicts: 1
Conflict discovered in file ‘hello.txt’.
Select: § postpone, (df) show diff, (e) edit file, (m) merge,
(mc) my side of conflict, (tc) their side of conflict,
(s) show all options:
出现代码冲突:
![在这里插入图片描述](https://img-blog.csdnimg.cn/304d5012767548b9b1de51fde0f04d0a.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
>
> 注意:文件版本变为5了;
>
>
>
可选值如下:
* p:推迟处理
* df:显示差异
* e:编辑文件
* m:合并
* mc:显示我的版本
* tc:显示他人的版本
* s:其他选项
##### 2)解决冲突
我们选择p,表示推迟处理,在出现冲突的文件同级目录中出现如下几个文件:
![在这里插入图片描述](https://img-blog.csdnimg.cn/a40d4c3945b04243b4b2b39f04415eb7.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_10,color_FFFFFF,t_70,g_se,x_16#pic_center)
* `hello.txt`:出现冲突的文件内容
11111aaa
22222bbb
<<<<<<< .mine
33333ddd
||||||| .r4
33333
33333ccc
.r5
44444
* `hello.txt.mine`:我们的文件内容
11111aaa
22222bbb
33333ddd
44444
* `hello.txt.r4`:4版本的文件内容
11111aaa
22222bbb
33333
44444
* `hello.txt.r5`:5版本的文件内容
11111aaa
22222bbb
33333ccc
44444
我们可以选择自己需要的内容填充到hello.txt中,然后直接提交:
PS D:\workspace\xiaolan\test_oa> svn commit -m “xiaolan update” hello.txt
Sending hello.txt
Transmitting file data .done
Committing transaction…
Committed revision 6.
PS D:\workspace\xiaolan\test_oa>
>
> 注意:文件版本变为5了
>
>
>
### 1.4 svn其他操作命令
#### 1.4.1 log命令
* 作用:log命令用于查看svn版本库的版本变更日志:
* 格式:
svn log [-r 起始版本:终止版本] 仓库地址
* 示例:
svn log -r 5:10 svn://localhost:8888/test_oa
svn log svn://localhost:8888/test_oa
![在这里插入图片描述](https://img-blog.csdnimg.cn/0ebf417198d243019be5c5118628d5ba.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
#### 1.4.2 list命令
* 作用:查看当前服务器文件列表:
svn list svn://localhost:8888/test_oa
![在这里插入图片描述](https://img-blog.csdnimg.cn/0c9a0012dd114480ab4775764c0cdc39.png#pic_center)
#### 1.4.3 diff命令
diff命令有多种用法,主要用于比较两个版本的不同
* 1)用法1:对比两个版本的不同
+ 格式:
+ ```
svn diff -r版本1:版本2
```
+ 示例:
+ ```
svn diff -r14:13 111.txt
```
+ ![在这里插入图片描述](https://img-blog.csdnimg.cn/a6cae92fab4641f1878b04d9ba172cfc.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
* 2)用法2:对比当前工作副本中的文件内容与svn服务器文件内容
+ 格式:
+ ```
svn diff -rhead 文件名
```
+ 示例:
+ ```
svn diff -rhead 111.txt
```
+ ![在这里插入图片描述](https://img-blog.csdnimg.cn/85c70a5500da46839d1db4b897a4416b.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
#### 1.4.4 merge命令
merge命令用于版本的回退
* 格式:
svn merge -r 当前最新版本:需要回退到的版本 文件名
* 示例:
svn merge -r 15:14 111.txt
回退后需要重新提交到svn服务器
svn commit -m “回退到14版本” 111.txt
#### 1.4.5 revert命令
revert命令用于撤销一系列动作,例如文件被执行了删除可以撤销、提交后出现冲突也可以撤销,回退到了指定版本也可以撤销;
* 格式:
svn revert 文件名
##### 1.4.5.1 删除撤销
1)删除hello.txt文件:
svn delete hello.txt
2)撤销删除:
svn revert hello.txt
##### 1.4.5.2 冲突撤销
说明:此时xiaohui和xiaolan都是最新版本的abc.txt文件,内容如下:
aaa
bbb
ccc
1)xiaohui编辑abc.txt:
aaa111
bbb
ccc
2)xiaohui提交文件:
PS D:\workspace\xiaohui\test_oa> svn commit -m “在第一行添加111” abc.txt
Sending abc.txt
Transmitting file data .done
Committing transaction…
Committed revision 21.
3)xiaolan编辑abc.txt:
aaa222
bbb
ccc
4)xiaolan更新到最新版本(产生冲突,出现冲突文件):
PS D:\workspace\xiaolan\test_oa> svn update abc.txt
Updating ‘abc.txt’:
C abc.txt
Updated to revision 21.
Summary of conflicts:
Text conflicts: 1
Conflict discovered in file ‘abc.txt’.
Select: § postpone, (df) show diff, (e) edit file, (m) merge,
(mc) my side of conflict, (tc) their side of conflict,
(s) show all options: p
Summary of conflicts:
Text conflicts: 1
出现冲突文件:
![在这里插入图片描述](https://img-blog.csdnimg.cn/bfda09ebba8f4f7e82615df4955fd566.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_16,color_FFFFFF,t_70,g_se,x_16#pic_center)
5)撤销冲突:
svn revert abc.txt
>
> tips:撤销冲突后,abc.txt文件版本变为21,也就是xiaohui提交的内容;
>
>
>
图解:
![在这里插入图片描述](https://img-blog.csdnimg.cn/efbb70da43cb48a5ac02f24734797619.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57eR5rC06ZW35rWBKno=,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)
##### 1.4.5.3 回退撤销
1)xiaohui新建222.txt:
2)添加到版本库进行版本管理:
svn add 222.txt
3)提交到svn服务器:
PS D:\workspace\xiaohui\test_oa> svn commit -m “初始化222文件” 222.txt
Adding 222.txt
Transmitting file data .done
Committing transaction…
Committed revision 22.
3)xiaolan进行update:
PS D:\workspace\xiaolan\test_oa> svn update 222.txt
Updating ‘222.txt’:
A 222.txt
给大家的福利
零基础入门
对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。
同时每个成长路线对应的板块都有配套的视频提供:
因篇幅有限,仅展示部分资料
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!