[Reprint] SVN User Guide under Ubuntu

Source: Internet
Author: User
Tags subversion client svn update

Address: http://blog.sina.com.cn/s/blog_4c451e0e0100dhbl.html

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]

-- Username User Name -- Password Password SVN Co SVN :// PATH (full directory or file path) [full local directory path] -- Username User Name -- Password Password
SVN checkout http :// PATH (full directory or file path) [full local directory path] -- Username User Name
SVN checkout SVN :// PATH (full directory or file path) [full local directory path] -- Username User Name
NOTE: If no -- Password If the parameter transmission password is used, the system prompts you to enter the password. We recommend that you do not use plain text. -- Password option .
Where Username And Password The first is 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 -- UsernameWzhnsc
SVN Co
Http ://
192.168.0.3/test/testapp -- UsernameWzhnsc
SVN checkout
SVN ://
192.168.0.3/Test Tool /Home/testtools -- UsernameWzhnsc
SVN Checkout Http :// 192.168.0.3/test/testapp-- UsernameWzhnsc

2. Export (
Export a directory tree without a. SVN folder )
SVNExport[-RVersion Number]Http ://PATH (full directory or file path)
[Local directory full path]-- UsernameUser Name
SVNExport[-RVersion Number]SVN ://PATH (full directory or file path)
[Local directory full path]-- UsernameUser Name
SVNExport 
Full directory path detected locally (with. SVN folder)
Full path of the local directory 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 path The 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
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 Export SVN :// 192.168.0.3/Test Tool /Home/testtools -- Username Wzhnsc
SVN Export Http :// 192.168.0.3/test/testapp -- Username Wzhnsc
SVN Export /Home/ Testapp /Home/testtools

3,
Add new file
SVN add File Name
Note: Tell the svn server to add files and use SVN commint-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 all my PHP files for testing" *. 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 that 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 <- Use the-no-Unlock switch to keep the lock.
SVN ci-m "Submit all files in the current directory under Version Control" * <- Note that 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 <- Use the-no-Unlock switch to keep the lock.

5. Update file
SVN update
SVN update-r
revised version file name
SVN update file name
example:
SVN update <-
there is no directory next to it. By default, all files in the current directory and subdirectories are updated to the latest version.
SVN update-r 200
test. CPP <- test the files in the version library. CPP
restored to revised version (revision) 200
SVN
Update test. php <- Update and version library synchronization.
An expiration conflict is prompted during submission. Update and modify the file first.
clear SVN resolved and submit 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. php"
The following operations are recommended:
SVN DeleteTest. 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. php test the test. php file"
SVN unlockTest. php

8. comparison
SVN diff file name
SVN diff-r corrected version m : corrected version n file name
example:
SVN diff test. php <- compares 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 st directory path/Name
SVN status directory path/name <- Status of files and subdirectories in the directory. The normal status is not displayed.
【?: Not under SVN control; M: The content is modified; C: A conflict occurs;
A: It is scheduled to be added to the version Library; K: locked]
svn-v directory path/name
SVN status-v directory 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 is locally deployed. SVN retains the original copy of the local version.

10. View logs
SVN log file name
example:
SVN log test. php <- shows all changes to the file and changes to the version number.

11,View File details
SVN infoFile Name
Example:
SVN infoTest. php

12,SVN help
SVN help <-All function options
SVN helpCi<-
Function Description

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 mkdir Directory 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,
Reuse SVN mkdir After the newsubdir command, 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 revertFoo. c<-Discard modifications to a file
SVN revert -- Recursive.<-Restore the entire directory file, which is the current directory.

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.<-
(Originally 123 of the branches) the current directory branch192.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

Address: http://blog.sina.com.cn/s/blog_4c451e0e0100dhbl.html

 

Refer:

Http://apps.hi.baidu.com/share/detail/20296807

Http://www.cnblogs.com/shitouer/archive/2011/08/30/2160070.html? Login = 1 # commentform

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.