SVN Common Commands

Source: Internet
Author: User
Tags svn update

1. Check out
SvnCoHTTP//path (full path to directory or file) [local directory full path]

--username User name--password password svnCosvn://path (full path to directory or file) [local directory full path]--username User name--password password
SvnCheckoutHTTP//path (full path to directory or file) [local directory full path]--username user name
SvnCheckoutsvn://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.
Example:
SVN co svn://localhost/Test Tools/home/testtools--usernameWzhnsc
SVN CO/HTTPLocalhost/test/testapp--usernameWzhnsc
svn checkout svn://localhost/Test Tools/home/testtools--usernameWzhnsc
SVNCheckout/ 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 Local checked out (i.e. with. 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 the URL,
If a revision number is specified, the corresponding version is exported.
If no revision is specified, the latest export is exported to the specified location.
if omittedLocal Directory full path, the last part of the URL is 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, and all local modifications will be preserved.
However, files that are not under version control (that is, new files that are not submitted because the. SVN folder does not have information records associated with it) are not copied.
Example:
SVNExport
svn://localhost/Test Tools/home/testtools--usernameWZHNSC
SVN Export
svn://Localhost/test/testapp--usernameWZHNSC
SVN Export
/home/TestApp/home/testtools

3. Add new files
SVN Add file name
Note: Tell SVN server to add files, but also use SVN commint-m real upload up!
Example:
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
Example:
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
Example:
SVN updatethere is no directory behind <-, and all files under the current directory and subdirectories are updated to the latest version by default
SVN update-rTest.cpp<-restore a file from the repository to a test.cpp version (revision) 200
SVN updatetest.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"
Example:
SVN Delete svn://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
Example:
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
Example:
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 StDirectory Path/Name
SVN status directory Path/name<-Status of files and subdirectories under directory, normal status not displayed
"?: Not in SVN's 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
Example:
SVN logtest.php<-Shows all changes to the file, and its version number

11. View File Details
SVN info file name
Example:
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)
Example:
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
Example:
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.
Example:
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
Example:
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]
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, not checkout and view the content of the output specific file or URL
SVN CAT/HTTP/File full path
Example:
SVN cat/HTTPLocalhost/test/readme.txt

19. Create a new branch copy

svn copy brancha Branchb -M "Make B Branch"//Copy a new branch from Brancha BRANCHB

20. Merge content to branch merge

svn merge brancha Branchb //merge changes to Brancha to branch BRANCHB



21.MAC Code Rollback
SVN merge--dry-run-r1162:1159 Http://svn-app.paic.com.cn/svn/hrmsv3_mlearning_app/trunk/Android/trunk documents/ Project/android/trunk


SVN merge-r1162:1159 http://svn-app.paic.com.cn/svn/hrmsv3_mlearning_app/trunk/Android/trunk liping/documents/ Project/android/trunk


SVN commit-m "Reverted to revision 2010."

SVN Common Commands

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.