September 14, 2017

Undo bad commit

Sometimes when you did commit like below, you have forgoten where you are and accidentally committed every local changes under the current folder tree, including some that you don't want to. Urrgh!

Example : svn commit -m 'blabla'

For example, above commit results in revision 101.

You want to get back the repo to what was in 100.

You run :
1. Go to the same folder when you did the commit

2. Merge to the previous revision i.e. 100
svn merge -c -100 .

3. Check what changes this one will take place
svn stat

4. Commit
svn commit -m 'sorry Im so dumb before but I learned now'

Now you have the new revision i.e. 102 is now back to what was in 100