SVN often uses commands for specific explanations (very comprehensive and useful)

Source: Internet
Author: User
Tags svn update
Install subversionclient in Ubuntu:

Sudo apt-getinstall subversion-Tools

1. Check out SVN Co http ://PATH (full path of folders or files) [full path of local folders]

 -- UsernameUser Name

-- PasswordPassword

SVN Co SVN ://PATH (full path of folders or files) [full path of local folders]-- UsernameUsername -- Password
SVN checkout http ://PATH (full path of folders or files) [full path of local folders]-- UsernameUser Name
SVN checkout SVN ://PATH (full path of folders or files) [full path of local folders]-- UsernameUser Name
Note: If you do not have the -- password limit transfer password, you will be prompted to enter the password. We recommend that you do not use the -- password option in plain text.
In this example, username and password are two short-lived periods, not one.
If the full path of the local folder is not specified, it is checked out to the current folder.
Example:
SVN Co SVN ://192.168.0.3/dig Test Tool/Home/testtools -- username Luke
SVN Co http ://
192.168.0.3/test/testapp-- Username Luke
SVN checkout SVN ://
192.168.0.3/dig Test Tool/Home/testtools -- username Luke
SVN checkout http ://
192.168.0.3/test/testapp-- Username Luke

 

2. Export (Export a clean folder tree without. SVN folders )

SVN export [-R version] http: // path (full path of folder or file) [full path of local folder] -- username Username
SVN export [-R version] SVN: // path (full path of folder or file) [full path of local folder] -- username Username
The full path of the local folder (with. SVN folder) detected locally by SVN export is the full path of the local folder to be exported.

Note: The first method to export the working folder tree from the version library is to specify the URL,
If the revision version number is specified, the corresponding version number is exported,
If no revision version is specified, the latest version is exported to the specified location.
If the full path of the local folder is omitted, the last part of the URL will be the name of the local folder.
Another way is to specify the full path of the local check-out folder to the full path of the local folder to be exported. All local changes will be retained,
However, files that are not under version number control (that is, new files that are not submitted, because there is no relevant information record in the. SVN directory) will not be copied.
Example:
SVN export SVN: // 192.168.0.3/home/testtools -- username Luke
SVN export http: // 192.168.0.3/test/testapp -- username Luke
SVN export/home/testapp/home/testtools


3. Add a new file SVN addFile Name
Note: It tells svnserver to add files, and also uploads files with SVN commint-M!
Example:
SVN add test. php add test. php
SVN commit-M "join my workshop to try test. php" test. php"
SVN add *. php add all PHP files in the current folder
SVN commit-M "join my pipeline to try all PHP files" *. php

4. Submit SVN commit-m"Submit remarks" [-N] [-- no-unlock]File Name
SVN ci-m"Submit remarks" [-N] [-- no-unlock]File Name
The-m limit number must be included, and the limit number can be null, but the-m limit must be written.
Example:
SVN commit-M "submit all files in the current folder under version number control" * Note this * indicates all files
SVN commit-M "submit my samples for trial test. php" test. php
SVN commit-M "submit my samples for trial test. php"-N -- no-Unlock test. php keep the lock and use the-no-Unlock switch.
SVN ci-M "submit all files in the current folder under version number control" * Note this * indicates all files
SVN ci-M "submit my samples for trial test. php" test. php
SVN ci-M "submit my samples for trial test. php"-N -- no-Unlock test. php keep the lock and use the-no-Unlock switch.

5. Update files SVN update
SVN Update-R
Corrected version number file name
SVN updateFile Name
Example:
There is no folder after SVN update. By default, all files in the current folder and subfolders are updated to the latest version.
SVN update-r 200test. cpp: restores the file test. cpp in the version library to version 200.
SVN update test. php updates are synchronized with the version library.
An expiration conflict is prompted during submission. You must update the file first,
Then clear the svn resolved and submit the commit.

6. delete an object SVN delete SVN ://PATH (full path of a folder or file) -M"Delete remarks text"
The following operations are recommended:
SVN DeleteFile Name
SVN ci-m"Delete remarks text"
Example:
SVN delete SVN: // 192.168.1.1/testapp/test. php-M "Delete the trial file test. php"
The following operations are recommended:
SVN delete test. php
SVN ci-M "Delete the trial file test. php"

7. Lock/unlock SVN lock-m"Lock remarks text" [-- Force]File Name
SVN unlockFile Name
Example:
SVN lock-m "use the test. php file" test. php"
SVN unlock test. php

8. Comparison SVN diffFile Name
SVN diff-RRevised version m :Revised version n  File Name
Example:
SVN diff test. php compares the modified file with the basic version number
SVN diff-r 200:201 test. php differs in the ratio of the corrected version 200 to that of the corrected version 201.

9. view the file or folder status SVN StFolder path/Name
SVN statusThe status of the files and subfolders in the folder path/name. The normal status is not displayed.
【? : Not under SVN control; M: The content is changed; C: A conflict occurs;
A: To be added to the version database; K: locked]
Svn-VFolder path/Name
SVN status-VFolder path/Name: displays the status of files and subfolders
[The first column remains the same, and the second column displays the working version,
The version and modifier of the last change are displayed in columns 3 and 4]
Note: SVN status, SVN diff, and SVN revert commands can also be run without a network,
The reason is that SVN retains the original copy of the local version number in local. SVN.

10. View logs SVN logFile Name
Example:
SVN Log Test. php displays all the changes and version changes to this file.

11. View File details SVN infoFile Name
Example:
SVN info test. php

12. SVN help SVN helpAll function options
SVN helpDetailed CI Functions

13. view the list of files and folders in the version Library SVN list SVN ://PATH (full path of a folder or file)
SVN ls SVN ://PATH (full path of a folder or file)
Example:
SVN list SVN ://192.168.0.3/test
SVN ls SVN ://192.168.0.3/test display SVN ://All files and folders in the 192.168.0.3/test folder that belong to the version Library

14. Create a new folder under version number control SVN mkdirFolder name
SVN mkdir-m"Add folder remarks text" Http ://Full folder path
Example:
SVN mkdir newdir
SVN mkdir-M "making a new dir." http: // 192.168.0.3/test/newdir
Note: After adding a subfolder, you must go back to the root folder and update it. Otherwise, a message indicating "failed to submit" is displayed when you submit a file in this folder"
SVN update
Note: Assume that a new folder newsubdir is created in the folder created by checkout,
After the svn mkdir newsubdir command is used, SVN will prompt:
SVN: Try to replace "SVN Add" or "SVN add -- Non-recursive?
SVN: unable to create the folder "hello": The file already exists
In this case, use the following command to solve the problem:
SVN add -- Non-recursive newsubdir
In the newsubdir folder, use LS-a to view all the folders and files below it, and you will find more:. SVN folder
Run the svn mkdir-M "add Hello function module File" SVN: // 192.168.0.3/test/newdir/newsubdir command,
SVN prompt:
SVN: file already exists: filesystem '/data/svnroot/test/db', transaction '2017-1 ',
Path '/newdir/newsubdir'

15. Restore local changes SVN revert [-- Recursive] File Name
Note: sub-commands do not access the network, and will release the conflict. However, it will not restore the deleted folder.
Example:
SVN revert Foo. c discards changes to a file
SVN revert -- Recursive. Restore the entire folder.

16. Copy the job and update it to another URL. SVN switch http ://Folder full path local folder full path
Example:
SVN switch http: // 192.163.0.3/test/456. (originally the 123 Branch) branch of the current folder to 192.163.0.3/test/456

 

17. Conflict Resolution SVN resolved[Full local folder path]
Example:
$ SVN update
C Foo. c
Updated to Revision 31.
Assume that you get a conflict during the update, your work copy will generate three new files:
$ Ls
Foo. c
Foo. C. Mine
Foo. C. R30
Foo. C. R31
When you conquer the foo. c conflict and are ready to submit, execute SVN resolved to let your work copy know that you have completed all the tasks.

You can only delete and submit conflicting files. However, in addition to deleting conflicting files, SVN resolved also fixes some record data in the copy management area at work. Therefore, we recommend that you use this command.

 

18. view the output content of a specific file or URL without checkout SVN cat http :// Full file path
Example:
SVN cat http: // 192.168.0.3/test/readme.txt

 

Supplement:

Suppose you wantChange the username and password of SVNFor Linux:

 

1. Temporary Switch

 

Add the -- username and -- password options under all commands.

 

For example, SVN up -- username zhangsan -- password 123456

 

2. Permanent Switch

 

Go ~ /. Subversion folder, command line: Cd ~ /. Subversion

 

Back up data before deletion, Just in case: Command Line: CP-R ~ /. Subversion/auth // home/Luke/

 

Rm-rf auth/delete non-empty folders, not to the recycle bin.

Delete folder ~ All files under/. Subversion/auth. During the next SVN operation, you will be prompted to enter username and password again. If you want to use it, you can. The system will record it by default.

SVN often uses commands for specific explanations (very comprehensive and useful)

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.