SVN principle----revert, rollback

Source: Internet
Author: User
Tags commit diff log log rollback sub command svn svn update

One, the sub command svn revert-cancel all local edits.

Let's take a look at the command svn revert example:
Discard changes to a file:
$ Svn revert foo.c
Reverted FOO.C
If you want to restore a whole directory of files, you can use the--depth=infinity option:
$ Svn revert--depth=infinity.
Reverted Newdir/afile
Reverted FOO.C
Reverted Bar.txt
Finally, you can cancel the scheduled operation:
$ svn Add mistake.txt Whoops
A Mistake.txt
A Whoops
A whoops/oopsie.c
$ Svn revert mistake.txt Whoops
Reverted Mistake.txt
Reverted whoops
$ SVN status
? Mistake.txt
? Whoops.

Second, rollback method

1. Fallback version Method 1: With SVN merge 1) First SVN up, to ensure the update to the latest version, such as 20; 2) then use SVN log, review the history changes to find the version to restore, such as 10. If you want to know more about the situation, you can use SVN diff-r 10:20 [file or directory]; 3) Roll back to version number 10:SVN merge-r 20:10 [file or directory], note the order between version numbers, this is called reverse merge; 4) View the differences between files in the current working version, such as Test.cpp and version Number 10: SVN diff-r test.cpp, If there is a difference, manually change it; 5) If there is no difference, then submit: SVN ci-m "back to R 10,xxxxx" [file or directory]. A new version, such as 21, will be generated in the SVN library. Method 2: Use SVN up 2 steps such as Method 1, then direct SVN up-r 10. The current working version is version 10. Note, however, that no new version will be generated in the SVN repository, and will return to the current version after the next svn up. ======================== changes have been submitted (commit). Use the SVN merge command to roll back. The procedure for rolling back is as follows: 1. Make sure we get the latest code: SVN update assumes the latest version number is 28. 2. Then find out the exact version number to roll back: SVN log assumes that the version number to rollback is 25 based on the SVN log log, where something can be a file, directory, or entire project if you want to know more about the situation, you can use SVN diff-r 28:25 "" 3, Rollback to version number 25:SVN merge-r 28:25 "" For the sake of insurance, reconfirm the results of the rollback: SVN diff "" found correctly, submitted. 4. Submit rollback: SVN commit-m "Revert revision from R28 to R25,because of ..." The post-commit version becomes 29. Summarize the above actions as follows: 1. Three. SVN update,svn log to find the latest version (latest revision) 2. Find the version number you want to roll back (Rollbak revision) 3. Roll back with svn merge: SVN merge-r: Something update to a version of SVN update-r version number SVN help update upDate (UP): Merges the revision of the repository into the working copy. Usage: Update [PATH ...] If no version is specified, the working copy is updated to the HEAD version. Otherwise, synchronize to the version specified by the-r option.






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.