Undoing specific revisions in Subversion

早过忘川 提交于 2019-11-29 20:49:01

To undo revisions 118 and 120:

svn up -r HEAD       # get latest revision
svn merge -c -120 .  # undo revision 120
svn merge -c -118 .  # undo revision 118
svn commit           # after solving problems (if any)

Also see the description in Undoing changes.

Note the minus in the -c -120 argument. The -c (or --change) switch is supported since Subversion 1.4, older versions can use -r 120:119.

There's a more straightforward way if you use TortoiseSVN, a Windows client for Subversion. You just click to view the log in your updated work copy, select the revisions you want to undo, right click, and select "Revert changes from these revisions".

It is a safe operation because the changes are applied just in your workspace. You still have to commit to modify your repository.

It is one of the best features of TortoiseSVN. I've always been a command line guy, but Tortoise changed my mind.

I suppose you could create a branch from revision 117, then merge everything except 118 and 120.

svn copy -r 117 source destination

Then checkout this branch and from there do svnmerge.py merge -r119,120-123

EDIT: This doesn't undo the revisions in the branch/trunk. Use svn merge instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!