svn命令之恢复误删的文件

如何恢复svn上误删的文件

项目目录、文件内容及历史记录如下所示

svn命令之恢复误删的文件_第1张图片

我们模拟进行了几次增删动作,最后删除index.c文件

svn命令之恢复误删的文件_第2张图片


现在,我们用命令行将工程检出

[root@localhost project]# svn co https://10.200.1.201/HSM/branches/test
A    test/src
Checked out revision 48243.

进行src目录下,cd test/src

执行merge命令

[root@localhost src]# svn merge -r HEAD:48236 https://10.200.1.201/HSM/branches/test/src .
--- Reverse-merging r48243 through r48237 into '.':
A    index.c
[root@localhost src]# 
查看svn状态,发现有一个文件index.c添加

[root@localhost src]# svn st
A  +    index.c
将文件提交到svn上

[root@localhost src]# svn ci -m "resovle index.c"
Adding         src/index.c

Committed revision 48244.

查看index.c的历史记录,发现找回来了

[root@localhost src]# svn log index.c -v
------------------------------------------------------------------------
r48244 | zqteng | 2016-07-05 21:21:05 +0800 (Tue, 05 Jul 2016) | 1 line
Changed paths:
   A /branches/test/src/index.c (from /branches/test/src/index.c:48236)

resovle index.c
------------------------------------------------------------------------
r48236 | zqteng | 2016-07-05 20:13:48 +0800 (Tue, 05 Jul 2016) | 1 line
Changed paths:
   M /branches/test/src/index.c

test5
------------------------------------------------------------------------
r48235 | zqteng | 2016-07-05 20:13:39 +0800 (Tue, 05 Jul 2016) | 1 line
Changed paths:
   M /branches/test/src/index.c

test4
------------------------------------------------------------------------
r48234 | zqteng | 2016-07-05 20:13:31 +0800 (Tue, 05 Jul 2016) | 1 line
Changed paths:
   M /branches/test/src/index.c

test3
------------------------------------------------------------------------
r48233 | zqteng | 2016-07-05 20:13:24 +0800 (Tue, 05 Jul 2016) | 1 line
Changed paths:
   M /branches/test/src/index.c

test2
------------------------------------------------------------------------
r48232 | zqteng | 2016-07-05 20:13:16 +0800 (Tue, 05 Jul 2016) | 1 line
Changed paths:
   A /branches/test/src/index.c

test1
------------------------------------------------------------------------
以下是eclipse中查看index.c文件的截图,以及文件内容

svn命令之恢复误删的文件_第3张图片







你可能感兴趣的:(svn命令之恢复误删的文件)