Reputation: 40653
A series of mistakes were made in a project I am working on. How do I revert back to a known working revision and build on top of that? Say I am at revision 15, but I want to go back to revision 10 -- and work on 10 onwards. I'm using Zend Studio.
Can I delete revisions that exist in SVN?
Upvotes: 47
Views: 104383
Reputation: 594
Get the docs from TortoiseSVN office site.
I use method 2 and work fine on my side.
https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html
Upvotes: 1
Reputation: 69035
You can simply do an update to revision using
svn up -r 10
But as Christoph has suggested this will not let you commit the changes as SVN needs you to update your working copy to HEAD before you can commit. What you can do instead is
svn merge -r HEAD:10 yourFile
svn ci yourFile -m "Reverting back to rev 10"
Upvotes: 19
Reputation: 9936
Three options:
Reverse merge: (fastest, keeps bad revisions, adds new revision)
svn merge $(REPO)@$(GOODREV) $(WC)
SVN dump: (removes bad revisions entirely)
svnadmin dump $(REPO) -r 1:$(GOODREV) > dumpfile
svnadmin load $(NEWREPO) < dumpfile
# Now delete $(REPO), and use $(NEWREPO)
Hand editing: (removes bad revisions, unsafe, last resort)
The only reason you might need this is if for some reason you have file-level access to the repository, but no shell access. Note that this has only been tested on SVN 1.6 and 1.7.
$(GOODREV)
(If left at HEAD
, it will be unusuable after we finish.)db/current
to the $(GOODREV)
. Be sure not to alter the LF
line ending.db/revs/*/*
and db/revprops/*/*
that are > $(GOODREV)
db/rep-cache.db
HEAD
, which should now be equal to $(GOODREV)
.Note that if you are using TortoiseSVN, you must also complete these steps:
%APPDATA%\TortoiseSVN\logcache\*
TSVNCache.exe
via the Task Manager. (There's usually one, but could be 2 on WinVista+ due to UAC security, which prevents elevated applications from interacting with a non-elevated TSVNCache.exe
. The first time you open a Save As...
dialog from an elevated application, an elevated TSVNCache.exe
will spawn.)This will fix the weird log display caused by TortoiseSVN's cache being in conflict with the new repo state.
Upvotes: 14
Reputation: 1252
From the command line:
svn up -r [revision_number]
Where [revision_number] is the revision you want to revert to.
And no, you cannot delete revisions that already exist in SVN.
Upvotes: 66