SVN command Collection

Source: Internet
Author: User
Tags svn update

1. Check out

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 checkout HTTP//path (full path to directory or file) [local directory full path]--username user name
SVN checkout svn://Path (full path to directory or file) [local directory full path]--username user name
Note: If you do not transfer the password with the--password parameter, you will be prompted to enter the password, it is recommended not to use the Clear text--password option.
Among them username and password before is two short-term, not one.
Does not specify a local directory full path, it is checked out to the current directory.
SVN cosvn://localhost/Test Tools/home/testtools --usernameWzhnsc
SVN CO/HTTPLocalhost/test/testapp--usernameWzhnsc
svn checkout svn://localhost/Test Tools/home/testtools --usernameWzhnsc
SVN Checkout/ httpLocalhost/test/testapp--usernameWzhnsc

2,Export (Export a clean directory tree without the. SVN folder)
SVN export [-R version number]/HTTP path (full path to directory or file) [local directory full path]--username user name
svn export  [-R version number] svn://path (full path to directory or file) [local directory full path]--username user name
svn export  locally checked out (that is, with the. svn folder) Directory full path   Local directory full path to export
Note: The first way to export a clean working directory tree from the repository is to specify URL,
If no revision is specified, the latest export is exported to the specified location.
,url will be the name of the local directory.
The second form is to specify the local checked-out directory full path to the local directory full path to be exported, all local modifications will be preserved ,
but not under version control (that is, new files are not submitted because the. SVN folder does not have information records associated with it) Files are not copied.
SVN Export
svn://localhost/Test Tools/home/testtools --username Wzhnsc
SVN Export
svn://Localhost/test/testapp--username Wzhnsc
SVN Export

3. Add new files
SVN Add file name
Note: Tell SVN server to add files, but also use SVN commint-m real upload up!
SVN addtest.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 test with all PHP files" *.php

4. Submit
SVN commit-m "Submit Memo Message Text" [-n] [--no-unlock] File name
SVN ci-m "Submit Memo Message Text" [-n] [--no-unlock] File name
Must be taken with the-m parameter, the argument can be empty, but must be written on-m
SVN commit-m"Submit all files under version control in the current directory" *<-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-unlocktest.php<-Keep the lock on and use the –no-unlock switch.
SVN ci-m"Submit all files under version control in the current directory" *<-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-unlocktest.php<-Keep the lock on and use the –no-unlock switch.

5. Update files
SVN update
SVN update-r fix version file name
SVN update file name
SVN update there is no directory behind <-, and all files under the current directory and subdirectories are updated to the latest version by default
SVN update-r 200test.cpp <- restore a file from the repository to a test.cpp version (revision) 200
svnupdate test.php <- the update synchronizes with the repository.
Prompt for expiration conflict when submitting, need update to modify file first,
Then remove the SVN resolved and commit the commit again.

6. Delete Files
SVN delete svn://path (full path to directory or file)-M "Delete Note information text"
The following actions are recommended:
SVN DeleteFilename
SVN ci-m"Delete Note Information text"
SVN deletesvn://localhost/testapp/test.php- M"Delete test file test.php"
The following actions are recommended:
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
SVN lock-m"Lock letter Test with test.php file" test.php
svn unlocktest.php

8. Compare differences
SVN diff file name
SVN diff-r fix version number m: Fixed version number n file name
SVN difftest.php<-Compare the modified file to the base version
SVN diff-r200:201 test.php<-Difference between revision number 200 and revision number 201

9. View file or directory status
SVN St directory Path/Name
SVN status directory Path/name<-Status of files and subdirectories under directory, normal status not displayed
"?: not in SVN control; M: Content has been modified; C: conflict;
A: To be added to the repository; K: Locked
Svn-v directory Path/Name
SVN status-v directory Path/Name<-displaying file and subdirectory status
"The first column remains the same, the second column shows the work version number,
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,
The reason is that SVN retains the original copy of the local version in the Local. SVN.

10. View Logs
SVN log file name
SVN logtest.php<-Shows all changes to the file, and its version number

11. View File Details
SVN info file name
SVN infotest.php

12. SVN Help
SVN help<-All features Options
SVN help CI<-Description of specific functions

13. View the 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)
SVN list svn://Localhost/test
svn ls svn://Localhost/test<-Showsvn://All files and directories in the Localhost/test directory that are part of the repository

14. Create a new directory under version control
SVN mkdir directory Name
SVN mkdir-m "New directory Memo text"/HTTP/Directory full path
SVN mkdirNewdir
SVN mkdir-m"Making a new dir."svn://Localhost/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 create a new folder Newsubdir manually in the checkout directory,
Re-useSVN mkdirAfter the Newsubdir command, SVN will prompt:
SVN: Try using "svn add" or "svn add--non-recursive" instead?
SVN: Unable to create directory "Hello": File already exists
At this point, use the following command to resolve:
   svn add--non-recursiveNewsubdir
When you enter this Newsubdir folder, you can see all the directories and files below it with ls-a:. SVN directory
Then use the SVN mkdir-m "Add Hello Function module file" Svn://localhost/test/newdir/newsubdir command,
SVN tip:
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.
svn revertFoo.c<-Discard changes to a file
svn revert--recursive.<-Restore a whole directory of files,. For the current directory

16. Update the work copy to another URL
SVN switch/HTTP/directory full path local directory full path
SVN switch/HTTP /localhost/test/456.<-(formerly 123 Branch) is currently located in the directory branch tolocalhost/test/456

17. Conflict resolution
SVN resolved [local directory full path]
$ 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
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 simply delete the conflicting files and submit them, but svnresolved also fixes some record data in the work Copy management area, in addition to deleting the conflicting files, so we recommend you use this command.

18, not checkout and view the content of the output specific file or URL
SVN CAT/HTTP/File full path
SVN cathttp://Localhost/test/readme.txt

19. Create a new branch copy

svn copy branchabranchb-m "make B branch"//Copy a new branch from Brancha BRANCHB

20. Merge content to branch merge

svn merge Branchabranchb//merge changes to Brancha to branch BRANCHB

SVN command Collection

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: 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.