Etam
Etam

Reputation: 4673

Back to revision in Subversion

suppose you update your code to revision 10 which is broken. You want to go back to revision 9, work on the code and wait until someone will fix the build:

svn merge -rHEAD:9 .

But it won't work, why?

Upvotes: 60

Views: 70608

Answers (5)

dotrinh DM
dotrinh DM

Reputation: 1393

SVN Show Log > Right Click Commit > Update item to revision

(click refresh button in Log Window to see current bold commit)

click refresh button in Log Window to see current bold commit

And this feature is the same git checkout a past commit

Upvotes: 0

Simone Carletti
Simone Carletti

Reputation: 176402

If you simply want to go back to an other revision, update is what you are looking for:

svn update -r 9

You can work on the code but you can't commit changes. Well, if revision 10 didn't change the same file you changed, you could commit but it's better if you wait for revision 10 to be fixed.

Instead, if you want to go ahead and work on the code, you might consider to create a branch from revision 9, go ahead in the branch and reintegrate the branch into trunk when revision 10 is fixed.

Upvotes: 129

user3228022
user3228022

Reputation: 11

svn update -r version-number, this method work fine for me, as i had to go back. but remeber to commit to changes to make sure. ok

Upvotes: 1

Adam Batkin
Adam Batkin

Reputation: 52994

Your best bet is to create a branch from revision 9 and continue working on that branch. When you are confident that the trunk is ready for your changes (i.e. it is fixed), merge your branch back in.

Upvotes: 2

Zachary Murray
Zachary Murray

Reputation: 1220

If you really don't want to revert using the merge command, you could always just check out a previous version by passing the -r option to checkout.

svn checkout http://yoursite/svn -r 9

When someone fixes revision 10 and commits 11, you can update normally and merge in your changes from your local copy of r9. Just resolve conflicts normally and then commit 12.

Upvotes: 6

Related Questions