Reputation: 511
I am working on a project which use svn. I checkout the latest version of it in a directory (using svn checkout http://url /path/to/dest
). I've done some modification, so I svn add
the modified files, and then svn commit
the changes.
Unfortunately, I did the change on the wrong branch. Right now what I'm trying to do is to svn update to a specific commit in another branch, using svn update -r 1234
, and I get the following error message:
svn: E160005: Target path '/dev/branches/project' does not exist
I switched to the correct branch with svn switch http://url
, and I still get the same error message. How can I properly revert to that commit ?
Upvotes: 0
Views: 233
Reputation: 55573
I think there are multiple problems with your approach.
First, the changes you commit in Subversion are irreversible¹, so the first thing you should do is to actually "undo" the effects of the wrong commit.
Since any commit can be considered "a patch" which specified what and how to change—compared to the state of the repository preceding the commit, to undo the changes introduced by a commit you record another commit which has changes exactly reverse to those in the original commit.
This is done by merging your wrong commit again but you tell Subversion to apply its changes in reverse—see this for more info.
Second, you want the wrong commit to appear on another branch. This is called "cherry-picking": you want to bring a particular change recorded elsewhere onto another branch.
Here is how it's done.
¹ From the client, that is. It's possible to perform special surgery on the physical repository using specialized tools. But I think this is not what we want to do here.
Upvotes: 0