svn命令之恢復誤刪的文件

如何恢復svn上誤刪的文件

項目目錄、文件內容及歷史記錄如下所示


我們模擬進行了幾次增刪動作,最後刪除index.c文件



現在,我們用命令行將工程檢出

[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文件的截圖,以及文件內容








發佈了31 篇原創文章 · 獲贊 3 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章