SVN code rollback command

Source: Internet
Author: User
Tags rollbak svn update
Canceling code modification can be divided into two situations: First case: the change is not submitted (COMMIT ).In this case, SVN revert can be used to cancel the previous modification. SVN revert usage: # SVN revert [-R] Something where something can be a relative path (directory or file) or an absolute path. When something is a single file, you can directly SVN revert something. When something is a directory, you need to add the parameter-R (recursive, recursive ), otherwise, only the something directory will be modified. In this case, you can also use the svn update command to cancel the previous modification, but it is not recommended. Because SVN update will connect to the repository server, it takes time. Note: SVN revert is inherently dangerous because it aims to discard uncommitted changes. Once you select recovery, subversion cannot retrieve uncommitted changes. Case 2: the change has been committed ).In this case, use the svn merge command for rollback. The rollback process is as follows: 1. Make sure that we get the latest code: SVN update assumes that the latest version number is 28. 2. Find the exact version number to be rolled back: SVN log [something]. Assume that the version number to be rolled back is 25 Based on the svn log, here, something can be a file, directory, or entire project. To learn more, you can use SVN diff-r 28:25 [something] 3. Roll Back to version 25: SVN merge-r 28:25 something for the sake of insurance, re-confirm the rollback result: SVN diff [something] found correct and submitted. 4. Submit rollback: SVN commit-M "revert revision from r28 to r25, because of..." The submitted version is changed to 29. The preceding operations are summarized as follows: 1. SVN update, SVN log, find the latest version (latest revision) 2. find the version number you want to roll back (rollbak Revision) 3. use SVN merge to roll back and forth: SVN merge-R: Something to cancel code modification in two cases: First case: the change is not submitted (COMMIT ).In this case, SVN revert can be used to cancel the previous modification. SVN revert usage: # SVN revert [-R] Something where something can be a relative path (directory or file) or an absolute path. When something is a single file, you can directly SVN revert something. When something is a directory, you need to add the parameter-R (recursive, recursive ), otherwise, only the something directory will be modified. In this case, you can also use the svn update command to cancel the previous modification, but it is not recommended. Because SVN update will connect to the repository server, it takes time. Note: SVN revert is inherently dangerous because it aims to discard uncommitted changes. Once you select recovery, subversion cannot retrieve uncommitted changes. Case 2: the change has been committed ).In this case, use the svn merge command for rollback. The rollback process is as follows: 1. Make sure that we get the latest code: SVN update assumes that the latest version number is 28. 2. Find the exact version number to be rolled back: SVN log [something]. Assume that the version number to be rolled back is 25 Based on the svn log, here, something can be a file, directory, or entire project. To learn more, you can use SVN diff-r 28:25 [something] 3. Roll Back to version 25: SVN merge-r 28:25 something for the sake of insurance, re-confirm the rollback result: SVN diff [something] found correct and submitted. 4. Submit rollback: SVN commit-M "revert revision from r28 to r25, because of..." The submitted version is changed to 29. The preceding operations are summarized as follows: 1. SVN update, SVN log, find the latest version (latest revision) 2. find the version number you want to roll back (rollbak Revision) 3. roll back and forth with SVN merge: SVN merge-R: something

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.