SVN Learning Notes (i)

Source: Internet
Author: User
Tags svn update

1. Check out commands

SVN CO/HTTP path (full path to directory or file) [local directory full path]--username user name--password password

SVN Co svn://path (full path to directory or file) [local directory full path]--username user name--password password

SVN checkouthttp://Path (full path to directory or file) [local directory full path]--username user name--password password

SVN checkoutsvn://Path (full path to directory or file) [local directory full path]--username user name--password password

If you do not have the--username and--password parameters, you will be prompted to enter your user name and password. In addition, the--password parameter specifies that you want to enter a clear text password, so this option is not recommended.

2. Export command (export a clean directory tree without the. SVN folder)

Svnexport [-R version number]//path (full path to directory or file) [local directory full path]--username user name--password password

Svnexport [-R version number] svn://path (full path to directory or file) [local directory full path]--username user name--password password

SVN export locally checked out (i.e. with. SVN folder) directory full path to export local directory full path

Note: The first form of exporting a clean working directory tree from the repository is the specified URL, and if a revision is specified, the appropriate version is exported or the latest is exported. The same parameter applies to the SVN Co and SVN checkout commands, and the second is to specify the local checked-out directory full path to the local directory full path to be exported, and all local modifications will be preserved. However, files that are not under version control are not copied.

3. Add a new file

svnadd [filename]//such as: Add Test.txt

4. Submit

SVN commit–m< Submit Memo message Text >[-n] [--no-unlock] File name

SVN Ci–m < Submit notes information text > [-n] [--no-unlock] File name

It should be noted that the-m parameter must be taken, the argument can be empty, but must be written on-M.

5. Update files

SVN update

SVN update–r fix version file name

SVN update file name

e.g.

SVN update//updates all files in the current directory and its subdirectories to the latest version

SVN update–r test.cpp//restore the files in the repository Test.cpp to the revised version (revision) 200

SVN updatetest.cpp//updates the specified file to the repository. If you are prompted for an expiration conflict at the time of submission, you need to update the file first, then clear the SVN resolved and commit the commit again.

6. deleting files

SVN deletesvn://Path (full path to directory or file) –m "Delete Note information text"

But the general steps should be:

SVN delete [filename]

SVN ci–m "Delete Note information text"

e.g.

SVN deletesvn://192.168.1.1/testapp/test.php–m "Delete test file test.php"

But the recommendations are as follows:

SVN deletetest.php

SVN ci–m "Delete test file test.php"

7. Locking/Unlock

SVN lock-m "Lock Memo Message text" [--force] File name
SVN unlock file name
e.g.:
SVN lock-m "lock letter Test with test.php file" test.php
SVN unlock test.php

8. Compare differences

SVN diff file name
SVN diff-r fix version number m: Fixed version number n file name
e.g.:
SVN diff test.php//Compare the modified file to the base version
SVN diff-r 200:201 test.php//Compare differences between fixed version number 200 and revision number 201

9. View file or directory status

SVN St directory Path/Name
SVN status directory path/name//directory State of files and subdirectories, normal status not displayed
<?: Not in SVN control, M: Content has been modified, C: conflict, A: scheduled to add to Repository, K: Locked >
Svn-v directory Path/Name
SVN status-v directory Path/name//display file and subdirectory status
[The first column remains the same, the second column shows the work version number, and the third and fourth columns show the last modified version number and the modified person]
Note: The SVN status, SVN diff, and SVN revert three commands can be executed without a network, because SVN retains the original copy of the local version in. svn.

10. View Logs

SVN log file name
e.g.:
SVN log test.php//Show all changes to this file and its version number

11. View File Details

SVN info file name
e.g.:
SVN info test.php

SVN help
SVN help <-all features options
Description of the specific features of the SVN help CI <-

13. View a list of files and directories under the repository
SVN list svn://path (full path to directory or file)
SVN ls svn://path (full path to directory or file)
Example:
SVN list Svn://192.168.0.3/test
SVN ls svn://192.168.0.3/test//Displays all files and directories belonging to the repository in the Svn://192.168.0.3/test directory

14. Create a new catalog under the included version control
SVN mkdir directory Name
SVN mkdir-m "New directory Memo text"/HTTP/Directory full path
Example:
SVN mkdir Newdir
SVN mkdir-m "Making a new dir." Http://192.168.0.3/test/newdir
Note: After adding subdirectories, be sure to go back to the root directory update, or the file will be submitted in this directory would prompt "commit failed"
SVN update

Note: If you manually create a new folder in the checkout directory Newsubdir,
    then use the Svn mkdir newsubdir command, SVN will prompt:
   svn:  try to replace with   "Svn add" or   "svn add --non-recursive"?
   svn:  could not create directory "Hello":  file already exists
    at this point, resolve with the following command:
    svn add --non-recursive newsubdir
    Enter this Newsubdir folder, with ls - A look at all the directories and files below it and find out more:. SVN directory
    re-use  svn mkdir -m  "Add Hello Function module file"  svn:/ /192.168.0.3/test/newdir/newsubdir  command,
&NBSP;&NBSP;&NBSP;SVN hint:
   svn: file  already exists: filesystem  '/data/svnroot/test/db ', transaction  ' 4541-1 ', path   '/newdir/newsubdir  '

15. Restore Local Modifications
svn revert [--recursive] file name
Note: The notebook command will not access the network and will release the conflicting condition. However, it does not restore the deleted directory.
Example:
svn revert foo.c//Discard changes to a file
svn revert--recursive. Restores the entire directory of files. As the current directory

16. Update the work copy to another URL
SVN switch/HTTP/directory full path local directory full path
Example:
SVN switch http://192.163.0.3/test/456. (formerly 123 Branch) The current directory branch 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 working copy will generate three new files:
$ ls
Foo.c
Foo.c.mine
Foo.c.r30
Foo.c.r31
When you have resolved the FOO.C conflict and are ready to submit, run SVN resolved and let your working copy know that you have done everything.
You can just delete the conflicting files and commit, but SVN resolved in addition to deleting the conflicting files, and also fixed some records in the work copy management area of the record data, so we recommend you use this command.

18. View the contents of the output specific file or URL without checkout
SVN CAT/HTTP/File full path
Example:
SVN cat Http://192.168.0.3/test/readme.txt

SVN Learning Notes (i)

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.