I have some changes commited a few commits back in my svn repository. Let's say HEAD is at r750 and I want to revert r745 without losing r746-r750. Is this possible?
And, can I somehow save r745 and reapply it later (as a new revision)?
Revert a File to a Specified RevisionRight-click a file in the Current Folder browser and select Source Control > Revert using SVN. In the Revert Files dialog box, choose a revision to revert to. Select a revision to view information about the change such as the author, date, and log message. Click Revert.
To revert a single commit: Go to: Subversion -> Integrate Directory... Show activity on this post. Note that the svn merge command reverts a commit in the sense of having another commit undoing your changes, but keeping your wrong commit in the history.
To undo a specific revision you can use the following command: $ svn merge -c -r3745 . In case you have other edited files in working directory, you can commit only the relevant files. Please note that undoing actually will mean you create a new revision with the negatives changes of last commit.
Supposing you get a clean backwards merge, you could do this...
svn merge -r 745:744 <source>
Then when you want to re-apply it, you could forward merge it back in:
svn merge --ignore-ancestry -r 744:745 <source>
For more info, check out the "Common Use-Cases for Merging."
Yes, this is definitely possible.
When you revert a change, it still creates a new revision in the repository. So you would do something like this:
1) Check out current copy r750.
2) Specify a revert on the working copy using svn merge -r
. Your working copy will have the old version merged in.
3) Check in the working copy as r751.
Now you'll have two revisions in the history. The new one (r751) which does not include r745, since you rolled it back. But r745 will still be there if you ever want to reapply it. You can simply check out a copy of r745, merge it into your working copy, and check it back in (say as r752).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With