Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What I am looking for here is how to manipulate Svn to effectively rollback my previous commit to the repository without affecting the changes I have made locally.

Let's say I do this:

$ svn ci abc.java -m "Updated abc"
Sending        abc.java
Transmitting file data .
Commited revision 123

And then realise that I don't want to make that update on the repository yet, but want to keep the changes I have made locally. I want my local files to stay the same, but the files on the repository to go back to revision 122.

I have only manged to find one way of doing this, is using a reverse merge:

$ svn merge -c -123 abc.java
--- Reverse-merging r123 into 'integer.c':
U    integer.c
$ svn commit -m "Undoing last change: rev 123."
Sending        abc.java
Transmitting file data .
Committed revision 124.

Unfortunately this means that I have to copy my local files elsewhere, before doing the reverse merge, and then copy my local file back after the commit.

I was wondering if there was a less circuitous way of doing this, where the operations only take place on the repository?

Thanks

share|improve this question

1 Answer 1

up vote 2 down vote accepted

1. Checkout new repo copy

2. Run:

svn merge -rHEAD:XXXX

(XXXX is the revision BEFORE the one you just committed)

3. Commit

4. Delete newly checked-out repo

share|improve this answer
    
Oooh nice one! Can't believe I didn't think of that one. Thank you! –  bguiz Nov 22 '09 at 1:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.