fix a committed mistake in subversion

半世苍凉 提交于 2019-12-13 13:17:32

问题


This seems like one of the most basic things that one might want to do with subversion, but I haven't been using version control systems for very long and somehow I can't seem to figure this out and I have no idea where in the svn documentation to look. Basically, revision 167 worked perfectly, but I made a mistake and committed it as revision 168 (and I'm not sure exactly where the mistake is). I ran svn update -r 167 and then svn revert to get my working copy back to revision 167, and everything works again. Now, I want to just start over from here - i.e. make a small change to this working copy and commit it as revision 169, completely ignoring everything that I did on revision 168.

How do I do this? When i try to just commit, tortoise svn gives me an error saying I need to update my working copy before I can commit, and obviously this is not what I want as it will bring me back to revision 168.

Thanks for the help!


回答1:


svn merge -r 168:167
svn ci -m "removing changes from r168"

http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo - here you can read about this technique in details.

as David Rodríguez - dribeas mentioned you should start with the HEAD revision. So perform svn up before the commands I adviced.




回答2:


In Subversion you cannot actually remove something you already committed. My advice is that you update your working copy to the latest revision and then open the "SVN Show Log" dialogue. Once in it, click on the mistaken revision and select the "Revert changes from this revision" context menu. Despite the name, it's not a revert operation (in Subversion revert means remove uncommitted local changes). TortoiseSVN will undo the changes in your local copy with a reverse merge operation. Check everything's fine and then commit.




回答3:


if you are using tortoise you can use see how to revert your commit here. Otherwise zerkms's command line commands should do the trick.




回答4:


Please read the TortoiseSVN documentation section titled Roll back (Undo) revisions in the repository. You can also access this documentation with the "Help" item in the TortoiseSVN context menu.



来源:https://stackoverflow.com/questions/4603536/fix-a-committed-mistake-in-subversion

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