當不小心誤提交了不該提交的代碼時,可以執行回滾操作
操作步驟
1.項目中右鍵TortoiseSVN --> Show log
2.右鍵點擊你想撤回的提交 -> Revert changes from this revision -->Revert -->OK
3.commit
4.恢復提交的代碼到本地. TortoiseSVN --> Show log 選中誤提交的版本export導出,覆蓋本地代碼就可以了
假設我們有許多個版本,版本號分別是1-10
如果我們在7這里選擇revert to this version那么7之后的8,9,10的操作都會被消除
如果在7選擇revert changes from this version那么7版本的修改將會被消除
如果同時選擇7,8 revert changes from this version那么7和8兩個版本的所做的修改都會被消除
update to revision和revert to revision很像,都會融合你本地未提交的修改。它們2個的區別是:
revert to revision會把這個rev作為最新版本,而update to revision不會。
所以 revert to revision 相當於 先update to revision,然后copy該內容到其他地方,然后update,然后再把內容覆蓋回來。
所以如果你想永久恢復到以前的某個版本,就用revert to revision
如果你只是想臨時恢復到以前的某個版本,那么就用update to revision
update to revision比revert to revision要常用得多
看看tortoise svn的右鍵菜單就知道了,有update to revision,但沒有revert to revision。
參考
https://www.jianshu.com/p/77f1b810cb95
https://blog.csdn.net/evsqiezi/article/details/88862047