Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fix a committed mistake in subversion

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!

like image 923
danny Avatar asked Dec 04 '22 10:12

danny


2 Answers

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.

like image 87
zerkms Avatar answered Dec 25 '22 16:12

zerkms


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.

like image 37
Álvaro González Avatar answered Dec 25 '22 17:12

Álvaro González