SVN User Guide under Ubuntu

Source: Internet
Author: User
Tags subversion client svn update

Install the Subversion client in Ubuntu:
Sudo apt-Get install subversion-Tools
See http://www.subversion.org.cn/svnbook/1.1/index.html SVN sub-commands for details
1. Check out

SVN Co http ://PATH (full directory or file path) [full local directory path]-- UsernameUsername -- PasswordSVN Co SVN ://PATH (full directory or file path) [full local directory path]-- UsernameUsername -- Password
SVN checkout http ://PATH (full directory or file path) [full local directory path]-- UsernameUser Name
SVN checkout SVN ://PATH (full directory or file path) [full local directory path]-- UsernameUser Name
Note: If the -- password parameter is not included, the system will prompt you to enter the password. We recommend that you do not use the -- password option in plain text.
Username and password are two short-term, not one.
If the full path of the local directory is not specified, the local directory is checked out.
Example:
SVN Co SVN ://192.168.0.3/Test Tool/Home/testtools -- Username wzhnsc
SVN Co http ://192.168.0.3/test/testapp-- Username wzhnsc
SVN checkout SVN ://192.168.0.3/Test Tool/Home/testtools -- Username wzhnsc
SVN CheckoutHttp ://192.168.0.3/test/testapp-- Username wzhnsc
2. Export (
Export a directory tree without a. SVN folder)
SVN export [-R version] http: // path (full path of directory or file) [full path of local directory] -- username Username
SVN export [-R version] SVN: // path (full path of directory or file) [full path of local directory] -- username Username
Local directory full path (with. SVN folder) detected by SVN export to Be Exported
Note: The first method to export the working directory tree from the version library is to specify the URL,
If the version number is specified, the corresponding version is exported,
If no version is specified, the latest version is exported to the specified location.
If omitted
Local directory full pathThe last part of the URL is used as the name of the local directory.
The second method is to specify the full path of the local directory to be exported. All local modifications will be retained,
But files that are not under Version Control (that is, new files that are not submitted, because there is no related information record in the. SVN folder) will not be copied.
Example:
SVN ExportSVN ://192.168.0.3/Test Tool/Home/testtools -- Username wzhnsc
SVN ExportHttp ://192.168.0.3/test/testapp-- Username wzhnsc
SVN Export/Home/Testapp/Home/testtools

3,
Add new file
SVN addFile Name
Note: Tell the svn server to add files and use SVN commit-m to upload files!
Example:
SVN add test. php <-add test. php
SVN commit-M "add my test with test. php" test. php
SVN add *. php <-add all PHP files in the current directory
SVN commit-M "add my tests with 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 parameter must be included. The parameter can be null, but it must be written as-M.
Example:
SVN commit-M "submit all files in the current directory under Version Control" * <-note this * indicates all files
SVN commit-M "submit my test with test. php" test. php
SVN commit-M "submit my test with 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 directory under Version Control" * <-note this * indicates all files
SVN ci-M "submit my test with test. php" test. php
SVN ci-M "submit my test with test. php"-N -- no-Unlock test. php <-keep the lock and use the-no-Unlock switch.
5,
Update files
SVN update
SVN Update-R
Revised version file name
SVN updateFile Name
Example:
SVN update <-No directory later. By default, all files in the current directory and sub-directories are updated to the latest version.
SVN Update-R 200 test. cpp <-restore the file test. cpp in the version Library to the revised version (revision) 200
SVN update test. php <-Synchronize updates with version libraries.
An expiration conflict is prompted during submission. You need to update and modify the file first,
Then clear the svn resolved and submit the commit.
6,
Delete an object
SVN delete SVN ://PATH (full directory or file path)-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 test file test. php"
The following operations are recommended:
SVN delete test. php
SVN ci-m "delete test. php"
7,Lock/unlock
SVN lock-m"Lock remarks text"[-- Force]File Name
SVN unlockFile Name
Example:
SVN lock-M "test the test. php file" test. php"
SVN unlock test. php
8,
Comparison
SVN diffFile Name
SVN diff-RCorrected version m:Corrected version n file name
Example:
SVN diff test. php <-compare the modified file with the basic version
SVN diff-r 200:201 test. php <-differences between version 200 and version 201
9,
View the file or directory status
SVN StDirectory path/Name
SVN statusDirectory path/name <-the status of the files and subdirectories under the directory. The normal status is not displayed.
【? : Not under SVN control; M: The content is modified; C: A conflict occurs;
A: To be added to the version Library; K: locked]
Svn-VDirectory path/Name
SVN status-VDirectory path/name <-display the file and subdirectory status
[The first column remains the same, and the second column displays the working version number,
The version number and modifier of the last modification are displayed in columns 3 and 4]
Note: SVN status, SVN diff, and SVN revert commands can be executed without a network,
The reason is that SVN retains the original copy of the local version in local. SVN.

10,View logs
SVN logFile Name
Example:
SVN Log Test. php <-displays all changes to the file and changes to the version number.
11,View File details
SVN infoFile Name
Example:
SVN info test. php
12,SVN help
SVN help<-All functional options
SVN helpCI <-description of specific functions
13,View the list of files and directories in the version Library
SVN listSVN ://PATH (full directory or file path)
SVN lsSVN ://PATH (full directory or file path)
Example:
SVN list SVN ://192.168.0.3/test
SVN ls SVN ://192.168.0.3/test <-DisplaySVN ://All files and directories belonging to the version library under the 192.168.0.3/test directory
14,Create a new directory under Version Control
SVN mkdirDirectory Name
SVN mkdir-m"Add directory remarks"Http ://Full directory path
Example:
SVN mkdir newdir
SVN mkdir-M "making a new dir." http: // 192.168.0.3/test/newdir
Note: After adding a subdirectory, you must update it in the root directory. Otherwise, a message indicating "failed to submit" is displayed when you submit the file in this directory"
SVN update
Note: If you manually create a new folder newsubdir in the directory that comes out of checkout,
After the svn mkdir newsubdir command is used, SVN will prompt:
SVN: how to replace "SVN Add" or "SVN add -- Non-recursive?
SVN: Unable to create directory "Hello": the file already exists
Run the following command to solve the problem:
SVN add -- Non-recursive newsubdir
In the newsubdir folder, use LS-a to view all the directories and files under it, and you will find more:. SVN directory
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 modification
SVN revert[-- Recursive]File Name
Note: The sub-commands do not access the network and will release the conflict. However, it does not restore the deleted directory.
Example:
SVN revert Foo. C <-Discard modifications to a file
SVN revert -- Recursive. <-restore the entire directory file.
16. Copy the job and update it to another URL.
SVN switch http ://Directory full path local directory full path
Example:
SVN switch http: // 192.163.0.3/test/456. <-(original 123 Branch) branch of the current directory to 192.163.0.3/test/456
17. Conflict Resolution
SVN resolved[Local directory full path]
Example:
$ SVN update
C Foo. c
Updated to Revision 31.
If 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 solve the foo. c conflict and are ready to submit, run SVN resolved to let your work copy know that you have done everything.
You can only delete and submit conflicting files. However, in addition to deleting conflicting files, SVN resolved also fixes record data in the work copy management area. 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

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.