How can you “Revert to this Revision” with a specific revision number from the Command Line?

我与影子孤独终老i 提交于 2019-11-30 22:48:13

It's important to get the terminology correct, because "revert" means something very specific in Subversion, whereas in English it can have multiple meanings based on context.

  • A Subversion "revert" is undoing any local, uncommitted changes and resetting the item back to its last known repository state. This is not what you're looking for.
  • "Reverting" via svn update -r is actually just updating the file to a specific (past) revision. You're "reverting" to an old revision, but you aren't really changing anything (and if you attempt to edit, then commit, you'll get rejected because you aren't editing the latest revision). Again, this is not what you're looking for.
  • A revert as you seem to be describing it would be better described as a "rollback" - you want to undo any changes made between the current revision and some revision in the past, and then commit the state of the item(s) as the new HEAD. In Subversion, this is referred to as a reverse merge. This is described in the Subversion manual - you supply svn merge with a range of revision numbers, in reverse order (newest to oldest), then commit the resulting working copy.

in many cases svn merge is preferable

however when I occured a similar problem, I found that a checkout to an earlier (stable) revision was more suitable, because it doesn't change my local changes and I can later still update to the current version

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