SVN Code rollback command

Source: Internet
Author: User
Tags diff svn update

Http://www.cnblogs.com/jndream/archive/2012/03/20/2407955.html

There are two scenarios for canceling changes to your code: The first case: The change was not committed (commit). In this case, the previous modification can be canceled using SVN revert. SVN revert usage is as follows: # svn revert [-r] something where something can be a relative path (directory or file) or an absolute path. When something is a single file, the direct svn revert something is OK, and when something is a directory, it needs to add the parameter-R (Recursive, recursion), otherwise it will only change the directory of something. In this case, you can also use the SVN Update command to cancel the previous modification, but it is not recommended. Because SVN update is going to connect to the warehouse server, it's time consuming. Note: The SVN revert itself is inherently dangerous because it is intended to discard uncommitted modifications. Once you have chosen recovery, Subversion has no way to retrieve uncommitted modifications. The second case: The change has been committed (commit). In this case, use the SVN merge command to roll back.      rollback is done as follows:     1, make sure we get the latest code:       SVN update       assumes that the latest version number is 28.     2, and then find out the exact version number to roll back:       SVN log [something]       assuming that the version number to rollback is 25 based on the SVN log log, the something here can be a file, a directory, or an entire project       if you want to learn more about the situation , you can use SVN diff-r 28:25 [something]   3, rollback to version number 25:       SVN Merge- R 28:25 something      for the sake of insurance, reconfirm the results of the rollback:        SVN Diff [something]      found to be correct and committed.    4, commit rollback:      SVN commit-m "Revert revision from R28 to R25,because of ..." & nbsp;      after the commit version became 29.     summarizes the above operations as three:    1. SVN update,svn log to find the latest version (latest revision)    2. Find the version number you want to roll back (Rollbak revision) &Nbsp;  3. Roll back with svn merge: SVN merge-r: something

SVN code rollback command

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.