Monday, July 11, 2011

svn command under linux

1, checkout the file to a local directory 
svn checkout path (path is the directory on the server) 
example: svn checkout svn: / / 
shorthand: svn co 
2, to add a new repository file 
svn add file 
for example: svn add test.php (added test.php)
svn add *. php (to add the current directory of all the php files) 
3, will change the file to the repository 
svn commit-m "LogMessage" [-N] [- no-unlock] PATH (if you chose to remain locked , on the use of-no-unlock switch) 
for example: svn commit-m "add test file for my test" test.php 
shorthand: svn CI 
4, lock / unlock 
svn lock-m "LockMessage" [- force] PATH 
For example: svn lock-M "lock Test file" test.php 
svn unlock PATH 
5, updated to a version of the 
svn update-rm path 
for example: 
svn Update if not followed by the directory, by default the current directory and subdirectories of all files update to the latest version. 
svn update-r 200 test.php (the repository file test.php revert to version 200) 
svn Update test.php (updated in the repository simultaneously, if the submission date, then when prompted, because of the conflict, the need First update, modify the file, then remove svn resolved, and finally submitted to commit) 
abbreviation: svn up 
6, to view the file or directory Status 
1) svn status path (directory files and subdirectories of the state, the normal state is not shown) 
[?: outside the control of svn; M: content is modified; C: conflict; A: pre-added to the repository; K: locked] 
2) svn status-v path (display status of files and subdirectories) 
in the first column remains the same, the first two displays working version, the third and fourth column shows the version number of the last modification and changes people. 
Note: svn status, svn diff, and svn revert command in the absence of these three cases, the network can do, because svn locally. Svn to keep the local version of the original copy. 
Shorthand: svn st 
7, delete the file 
svn delete path-m "delete test fle" 
For example: svn delete svn: / / "delete test file" 
or directly svn delete test. php and then svn ci-m 'delete test file', recommended the use of this 
shorthand: svn (del, remove, RM) 
8, view the log 
svn log path 
for example: svn log test.php shows all the changes the file records, and changes in its version number 
9, to view file details 
svn info path 
for example: svn info test.php 
10, the difference 
svn diff path (the file will be modified compared with the basic version) 
for example: test.php svn diff 
svn diff-RM: n path (to the version difference between m and n version) 
for example: svn diff-r 200:201 test.php 
shorthand: svn di 
11, the difference between the two versions will be merged into the current file 
svn merge-rm: n path 
such as : svn merge-r 200:205 test.php (the version of the difference between 200 and 205 merged into the current file, but usually in conflict, need to deal with) 
12, SVN Help 
Help svn 
svn Help CI 
----- --------------------- 
These are the frequently used commands, the following written a few infrequently used 
---------------- ---------- 
13, the repository of files and directories under the list of 
svn list path 
shows the directory path is the repository of all files and directories 
abbreviated: svn ls 
14, created into a new directory under version control 
svn mkdir: created into a new directory under version control. 
Usage: 1, mkdir PATH ... 
2, mkdir URL ... 
create a version-controlled directory. 
1, each copy of PATH to specify the working directory will be created locally, and add a new 
schedule to be submitted to the next. 
2, each directory specified in a URL will be submitted to the warehouse through the immediate creation. 
In both cases, all the intermediate directories must exist in advance. 
15, restoring local changes 
svn revert: to restore the original working copy of the file does not change (to restore most of the local modifications). revert: 
Usage: revert PATH ... 
Note: The order book does not access the network, and will remove the conflict situation. But it does not restore 
the deleted directory 
16, the code base URL change 
svn switch (sw): Update working copy to a different URL. 
Usage: 1, Switch URL [PATH] 
2, Switch-RELOCATE FROM TO [PATH ...] 
1, update your working copy, maps to a new URL, their behavior with the "svn update" like, will also 
on file with the local file server consolidation. This is the working copy of the repository corresponding to the same branch or tag in a 
2, copy the URL rewriting job metadata to reflect changes on the URL alone. When the repository root URL changes 
(such as program name or host name changes), but the working copy is still mapped to the same repository using the same directory 
with this command to update the working copy of the correspondence between the warehouse. 
17, to resolve conflicts 
svn resolved: remove the working copy of the directory or file a "conflict" state. 
Usage: resolved PATH ... 
Note: The book is not in accordance with the command syntax to solve the conflict or remove the conflict markers; it just removes conflict 
-related documents, and then let the PATH can be re-submitted. 
18, output the contents of the specified file or URL. 
svn cat target [@ version] ... If you specify a version, the version from the specified search. 
svn cat-r PREV filename> filename (PREV is the previous version, you can write the specific version number, so the output can be submitted)