Simple sorting of SVN usage and svn usage
1. Create the storage Dir on the SVN server and establish contact with the personal host. Create a storage folder svn_storeDir on the SVN server. create a local folder local_Dir on your PC. go to the local_Dir folder and use the checkOut function of the svn software to check out the content of svn_storeDir to the local folder. You can establish a connection with the SVN server. Run the following command: svn checkout svn: // 192.168.0.252/Release./2. Update the local file to the latest version before getting started every day. The SVN update function is required. Run the following command: svn update 3. After adding a file to the local folder, you can use the SVN commit function to submit the backup in real time. Svn add ssDirsvn commit-m "I add a dir to localDir" ssDir // some versions of svn must be added after submission, if you have modified one or more files submitted previously, you can directly submit svn commit-m "I edit some files for a new function" 4. delete an object from a local folder. Svn rm ssDirsvn commit-m "I delete a dir to localDir" 5. view all logs svn logsvn log-r 5:19 # shows logs 5 through 19 in chronological order
Svn log-r 19:5 # shows logs 5 through 19 in reverse order
Svn log-r 8 # shows log for revision 8svn log-r {2015-07-31 }:{ 2015-06-01} # view svn logs on a specified date, and the new log is displayed in the previous update to the 0xxx version svn update-r 0xxx 6. export File: This command will not be used to copy the file. svn export [-r REV] URL [@ PEGREV] [PATH] svn export-r 68217 svn: // 192.168.0.252/CCDT2010/Firmware/demo2. /svn export-r 68217 svn: // 192.168.0.252/CCDT2010/Firmware/demo1.txt. /demow.68217.txt 7. the svn code rollback command can be used to cancel code modification in 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
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. To restore multiple files or multi-level sub-directories, run the following command: svn revert */**/*
Case 2: the change has been committed ).
In this case, use the svn merge command for rollback.
The rollback procedure is as follows:
1> make sure we get the latest code:
Svn update
Assume that the latest version is 28.
2> find the exact version number for rollback:
Svn log [something]
Assume that the version number to be rolled back is 25 Based on the svn log. The something here can be a file, directory, or the entire project.
For more details, use svn diff-r 28:25 [something]
3> rollback to version 25:
Svn merge-r 28:25 something
For the sake of insurance, confirm the rollback result again:
Svn diff [something]
Submit if the information is correct.
4> submit rollback:
Svn commit-m "Revert revision from r28 to r25, because ..."
The submitted version is changed to 29.
The preceding operations are summarized as follows:
A> svn update and svn log. Find the latest version (latest revision)
B> Find the version number (rollbak revision) You want to roll back)
C> Use svn merge to roll back and forth: svn merge-r: something 8. create a branch for the Code. If you want to add a powerful function to the code, but do not want to submit it to the main repository for the time being, you are afraid to influence others' work. You can create a branch for the main repository code, and then download the branch to the local to modify it. After the test is confirmed OK, submit it to the master warehouse. Svn cp-m "creat vbase_branch" svn: // 172.16.0.26/trunk/Vbase svn: // 172.16.0.26/wangwj/workDir/branch/vbase_branch svn checkout svn: // 172.16.0.26/wangwj/workDir/branch/vbase_branch. /9. other commonly used svn commands: svn list svn: // 192.168.0.252/CCDT2010/Firmware/Tuner/Release/v25/t221_v251_1.01.0002svn delete svn: // 192.168.0.252/CCDT2010/Firmware/Tuner/Release/v25/t221_v251_1.01.0002/xsvn diff-r id1: id2 fileName