You’re using subversion and you accidentally checkin some code before it’s ready. For example, I often: a) checkin some code, then b) edit a little, then c) hit up, enter to repeat the previous command which unfortunately was a checkin.
Is it possible to retract such an accidental checkin from the server with subversion?
NB: THIS PROBABLY WON’T WORK ON CURRENT VERSIONS OF SUBVERSION AND IS A BAD IDEA – but I’ve left it here for information
NB: Normally when you have checked in by mistake, you should just revert the commit – see the other answers to this question. However, if you want to know how to actually undo the effects of the commit and change the repository to be how it was before, there’s some explanation below:
This isn’t what you normally want, but if you really want to remove the actual committed version from the repository, then you can do a nasty rollback on the repository as follows (this assumes that
$REVis set to the latest revision, which you are removing):svn revert -r $((REV-1)))db/revs/$REVanddb/revprops/$REVdb/currentand (for subversion 1.6 or greater)db/rep-cache.db, and runsvnadmin recover .db/rep-cache.dbto prevent attempt to write a readonly database errorsThis all assumes:
fsfs-based repository1.5.0(otherwise you have to manually editdb/currentand change the revision number rather than runningsvnadmin recover .)I’ve done it when a huge file was committed to a repository that I didn’t want to stay in the history (and mirrors etc) forever; it’s not in any way ideal or normal practice…