1. Checkout the file to the local
svn checkout path (path is the directory of the server)
For example: svn checkout svn://192.168.1.1/pro/domain
2. Add new files to the repository
svn add filename
For example: svn add test.cpp
3. Submit the changed files to the repository
svn commit -m "comment " [ -N ] [ --no-unlock ] PATH (use --no-unlock switch if hold lock is selected)
For example: svn commit -m "comment " test.cpp
Abbreviation: svn ci
4. Lock/Unlock
svn lock -m "注释" path
Example: svn lock -m "comment" test.cpp
svn unlock path
5. Update to a certain version
svn update -r version number path
svn update updates all files in the current directory and subdirectories to the latest version
svn upate -r 200 test.cpp restores test.cpp in the repository to version 200
shorthand svn up
6. View file or directory status
(1) svn status path (display the status of files in the directory and files in subdirectories, the normal status is not displayed)
[?: Not in svn control; M: Content modified; C: Conflict; A: Predefined to add to the repository; K: Locked]
(2) svn status -v path (display file and subdirectory status)
Note: The three commands svn status, svn diff and svn revert can be executed without a network, because svn keeps the original copy of the local version in the local .svn.
Shorthand: svn st
7. Delete files
svn delete path -m "comment"
例如: svn delete svn://192.168.1.1/pro/domain/test.cpp -m "delete test file"
Or directly svn delete test.php and then svn ci -m 'delete test file', it is recommended to use this
Shorthand: svn (del, remove, rm)
8. View the log
svn log path
9. View file details
svn info path
10. Compare the differences
svn diff path (compare modified files with base version)
svn diff -rm:n (compare the m version of the modified file with the n version)
shorthand svn di
11. Merge the differences of the two versions of the file into the current file
svn merge -r m:n path
For example: svn merge -r 20 : 25 test.cpp (merge the differences between versions 20 and 25 into the current file, but conflicts usually occur and need to be dealt with)
12. SVN help
svn help
The above are the commonly used commands, the following are the less commonly used commands
13. View the files and lists under the repository
svn list path (display the files and directories that belong to the version in the path directory)
Shorthand: svn ls
14. Create a new directory under version control
svn mkdir : Create a new directory under version control.
Usage: 1. mkdir PATH...2、mkdir URL...
Create a version-controlled directory.
1、每一个以工作副本 PATH 指定的目录,都会创建在本地端,并且加入新增调度,以待下一次的提交。
2、每个以URL指定的目录,都会透过立即提交于仓库中创建。在这两个情况下,所有的中间目录都必须事先存在。
15、恢复本地修改
svn revert:恢复原始未改变的工作副本文件(恢复大部分的本地修改)revert用法:revert path
注意:本子命令不会存储网络,并且会解除冲突的情况。但它不会恢复被创建的目录
16、代码库URL变更
svn switch(sw): 更新工作副本到不同的URL。
用法 1、switch URL [PATH]
2、switch --relocate FROM TO [PATH]
1、更新工作副本,映射到一个新的URL,会将服务上的文件与本地文件合并。这是将工作副本对应到同一创库的某个分支或者标记的方法。
2、改写工作副本URL元数据,以反映URL的变更,创库URL变动但工作副本仍旧对映同一创库的同一目录时使用该命令更新工作副本与创库的对应关系。
17、解决冲突
svn resolved:移除工作副本的目录或文件的“冲突”状态。
用法 resolved path
注意:本子命令不会依语法来解决冲突或是移除冲突标记;它只是移除冲突的相关文件,然后让path可以再次提交。
18、输出指定文件的URL内容