SVN command usage details, svn Usage Details

Source: Internet
Author: User
Tags svn update

SVN command usage details, svn Usage Details

Address: http://www.roncoo.com/article/detail/124725

1. Check out
Svn co http: // path (full directory or file path) [full local directory path] -- username -- password

Svn co svn: // path (full directory or file path) [full local directory path] -- username -- password
Svn checkout http: // path (full directory or file path) [full local directory path] -- username
Svn checkout svn: // path (full directory or file path) [full local directory path] -- username
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: // localhost/test tool/home/testtools -- username wzhnsc
Svn co http: // localhost/test/testapp -- username wzhnsc
Svn checkout svn: // localhost/test tool/home/testtools -- username wzhnsc
Svn checkouthttp: // localhost/test/testapp -- username wzhnsc

2. Export (export a directory tree without the. svn folder)
Svn export [-r version] http: // path (full path of directory or file) [full path of local directory] -- username
Svn export [-r version] svn: // path (full path of directory or file) [full path of local directory] -- 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 the full path of the local directory is omitted, 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 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: // localhost/test tool/home/testtools -- username wzhnsc
Svn export svn: // localhost/test/testapp -- username wzhnsc
Svn export/home/testapp/home/testtools

3. Add a 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 my tests with all php files" *. php

4. Submit
Svn commit-m "submit remarks text" [-N] [-- no-unlock] File Name
Svn ci-m "submit remarks text" [-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 update file 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 delete file name
Svn ci-m "delete remarks text"
Example:
Svn delete svn: // localhost/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 unlock file name
Example:
Svn lock-m "test the test. php file" test. php"
Svn unlock test. php

8. Differences
Svn diff file name
Svn diff-r corrected version number m: Corrected version number 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 st directory path/Name
Svn status directory 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-v directory path/Name
Svn status-v directory path/name <-display 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 log File Name
Example:
Svn log test. php <-displays all changes to the file and changes to the version number.

11. View File details
Svn info file name
Example:
Svn info test. php

12. SVN help
Svn help <-all functional options
Svn help ci <-Function Description

13. view the files and directories in the version Library
Svn list svn: // path (full directory or file path)
Svn ls svn: // path (full directory or file path)
Example:
Svn list svn: // localhost/test
Svn ls svn: // localhost/test <-display all files and directories belonging to the version library under the svn: // localhost/test directory

14. Create a new directory under Version Control
Svn mkdir directory name
Svn mkdir-m "add directory remarks text" http: // full directory path
Example:
Svn mkdir newdir
Svn mkdir-m "Making a new dir." svn: // localhost/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: // localhost/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: // localhost/test/456. <-(originally the 123 Branch) branch of the current directory to localhost/test/456

17. Conflict Resolution
Svn resolved [full local directory]
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: // localhost/test/readme.txt

19. Create a branch copy

Svn copy branchA branchB-m "make B branch" // copy a new branch branchB from branchA

20. merge the content to the branch merge

Svn merge branchA branchB // merge the modifications to branchA into branchB

Related Article

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.