How do I change the HEAD to a previous revision

有些话、适合烂在心里 提交于 2019-12-03 22:59:35

Maybe you can show log, check previous revision (n-1), in context menu choose Revert to this revision and commit the changes (it will becomes n+1, where n is current bad head)

The cleanest way would be to undo changes

You can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference. (You can do this by specifying --revision 303:302, or by an equivalent --change -303.)

I realize it does not "make it like that last commit never happened" in the sense that commit is still part of history, but I believe it is better to keep that bad commit in the history.
It could include some work in progress that can be queried / compared to, in order to easily remake a new proper commit.


Even if:

  • the SVN (1.5) manual mention a future obliterate command that would accomplish the task of permanently deleting information, and
  • mention svndumpfilter as a possible workaround (in that it provides the ability to quickly and easily modify that dumpfile data by acting as a path-based filter)

... It is better to not try twisting a SCM tool into something it is not meant to do in the first place.
Historization (along with parallelization with branching) are the two main features of an SCM.

Greg Hewgill

You can do this using svnadmin dump and svnadmin load. It's quite a brute force way to do it, but I believe that's the only way to do it.

The answers to this question may help: Nuking huge file in svn repository

You can svn cp specific revisions, so if there are no intervening operations that you wan to save, you could svn rm the offending directory and then svn cp the old version. See the Peg and Operative Revision section of the book

Using TortoiseSVN, if you want to just see the repository at the version before the offending commit:

  • Open the URL with the TortoiseSVN Repository Browser.
  • Note the revision number of that commit and change HEAD to that number - 1 by clicking the button on top right side.

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