Install SVN command sudo apt-get install subversion subversion-tools
For details, see http://www.subversion.org.cn/svnbook/1.1/index.html SVN subcommand
1. Check out
SVN CO/HTTPPath (full path to directory or file) [local directory full path]
--usernameUser name--password password
SVN co svn://Path (full path to directory or file) [local directory full path]
--usernameUser name--password password
SVN checkout/HTTPPath (full path to directory or file) [local directory full path]
--usernameUser name
svn checkout svn://Path (full path to directory or file) [local directory full path]
--usernameUser 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://192.168.0.3/Test Tools
/home/testtools
--username WZHNSC
SVN CO/HTTP192.168.0.3/test/testapp
--username WZHNSC
svn checkout svn://192.168.0.3/Test Tools
/home/testtools
--username WZHNSC
SVN
Checkout
/ http192.168.0.3/test/testapp
--username WZHNSC
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 (i.e. with. SVN folder) directory full path to export local directory full path
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 omitted
Local 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:
SVN
Export
svn://192.168.0.3/Test Tools
/home/testtools
--username WZHNSC
SVN
Export
/ http192.168.0.3/test/testapp
--username WZHNSC
SVN
Export
/home/TestApp
/home/testtools
3.
Add a new file
SVN addFilename
Note: Tell SVN server to add files, but also use SVN commint-m real upload up!
Example:
SVN add test.php <-added test.php
SVN commit-m "add my Test with test.php" test.php
SVN add *.php <-Adding all php files in the current directory
SVN commit-m "add my test with all PHP files" *.php
4.
Submit
SVN commit-m"Submit Notes Information text"
[-n] [--no-unlock]Filename
svn ci
- M"Submit Notes Information text"
[-n] [--no-unlock]Filename
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-unlock test.php <-keep the lock on with 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-unlock test.php <-keep the lock on with the –no-unlock switch
5.
update File
SVN update
SVN update-rFix version file name
SVN updateFilename
Example:
There is no directory behind SVN update <-, and all files under the current directory and subdirectories are updated to the latest version by default
SVN update-r test.cpp <-Restore the files in the repository Test.cpp to the revised version (revision) 200
SVN update test.php <-updates are synchronized 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.
Deleting 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://192.168.1.1/testapp/test.php-m "Delete test file test.php"
The following actions are recommended:
SVN Delete test.php
SVN ci-m "Delete test file test.php"
7.
Locking/Unlock
SVN lock-m"Lock Note Information text"
[--force]Filename
svn unlockFilename
Example:
SVN lock-m "lock letter Test with test.php file" test.php
SVN unlock test.php
8.
Compare Differences
SVN diffFilename
SVN diff-rFixed version number M
:Fixed version number n
Filename
Example:
SVN diff test.php<-Comparing modified files to the underlying version
SVN diff-r 200:201 test.php<-difference between fixed version number 200 and revision number 201
9.
view file or directory status
SVN StDirectory Path/Name
SVN statusStatus of files and subdirectories under directory path/name <-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-vDirectory Path/Name
SVN status-vDirectory path/name <-display 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 logFilename
Example:
SVN log test.php<-shows all the changes to this file, and the change in its version number to view the latest updated N information svn log file name--limit n-v
11.
View File Details
SVN infoFilename
Example:
SVN info test.php
12.
SVN Help
SVN Help<-All features Options
SVN HelpDescription of CI <-specific functions
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 <-Display
svn://All files and directories in the 192.168.0.3/test directory that are part of the repository
14.
to create a new catalog under the included version control
SVN mkdirDirectory Name
SVN mkdir-m"New Directory Notes text"
/ httpDirectory 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 create a new folder Newsubdir manually in the checkout directory,
After using the SVN mkdir 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-recursive Newsubdir
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://192.168.0.3/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 revert foo.c <-discard changes to a file
svn revert--recursive. <-restores a whole 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) 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, not checkout and view the content of the output specific file or URL
SVN cat/HTTPFile full path
Example:
SVN cat Http://192.168.0.3/test/readme.txt
Use of SVN under Ubuntu