[Command parameters] SVN - environment configuration and common command parameters

Table of contents

Environment configuration

basic grammar

Parameter command


        SVN is a version control system based on C/S architecture, which can realize version hosting of product projects and efficient management of source code libraries. Mastering some command parameters in SVN can further improve daily efficiency to a certain extent.

Environment configuration

        To make calling more convenient, SVN is usually configured into environment variables. Find the path where svn.exe is located (under the TortoiseSVN/bin folder), then press  Win + R  to call Run (Administrator) and enter cmd, then enter the following command: 

#如果需要加入到系统变量则在Path前加入 /m 即可
setx Path "%Path%;svn.exe的所在路径"

basic grammar

        The svn command parameter line provides the opportunity to integrate version management functions into other software. Its usage syntax is as follows:

svn [指令] 
# 示例 : svn checkout https://192.168.107.118/pro

Parameter command

instruction abbreviation describe
checkout PATH co Used to check files on the PATH path to the local directory
add FILE \ Add the specified file to the repository.

Example:
#Add test.cpp to the repository
svn add test.cpp
#Add all files in the current directory to the repository
svn add *
help \ Show svn parameter command line usage
commit -m “LogMessage“ PATH ci

Submit changed files to the repository

Example:

#Submit the test.cpp file with the message "Information to be submitted
" Svn commit -m "Information to be submitted" test.cpp

#Submit all files with the message "Information to be submitted"

svn commit -m "information to be submitted" * 

lock/unlock -m “LockMessage“ [--force] PATH \ Lock/unlock files

Example:
Svn lock -m "Lock the file" test.cpp
Svn unlock test.cpp
update -r m PATH up Update files in the current directory and subdirectories to the latest version.

Example:
#Update all files in the current directory and subdirectories to the latest version
Svn update
#Restore the test.cpp file to the state of version v145
Svn update -r 145 test.cpp
status -v PATH st Check the status of the file or directory.

The meaning of the symbols is as follows:
?: Not in the svn repository M: The content has been modified C: There is a conflict A: Pre-added to the repository
K: Locked

Example:
Svn status test.cpp #Display test .cpp file status
Svn -v status test.cpp #Additionally display the current version number, last modified version number, and modified person of test.cpp
delete/remove PATH -m “DelMessage” del\rm Delete files or folders in the svn server.

Example: # Complete Svn delete
in the repository immediately https://192.168.107.118/pro/test -m "Delete test folder" #Delete test.cpp in the local directory, And include it in the next submission process Svn delete test.cpp -m "delete test.cpp"


log PATH \ 显示指定文件或文件夹下的所有修改记录包括版本号变化的记录日志
diff -r m:n PATH diff 比较版本m与版本n之间的差异。若只使用diff PATH,则默认比较当前被修改的版本与最后一次上传更新的版本之间的差异。

例子:
#比较版本145和版本146之间的差异
Svn diff -r 145:146 test.cpp
#比较当前修改的版本与最后一次更新上传的版本之间的差异
Svn diff test.cpp
list PATH ls 显示PATH路径下版本库中的文件、目录列表
mkdir PATH/URL \ 创建本地目录文件夹,并纳入到下一阶段提交流程之中/创建svn远端文件夹,即刻同步到svn远端版本库中

例子:
#创建TestFolder文件夹
Svn mkdir TestFolder
#在远端创建TestFolder文件夹
Svn mkdir http://192.168.107.118/pro/TestFolder
revert PATH \ 将当前目录或文件恢复到上一次最新版本

例子:
#将test.cpp恢复至上一个最新版本
Svn revert test.cpp
resolved PATH \ 移除当前文件或目录的冲突标记,并纳入到下个提交流程中

* 常用参数以红色标记 

拓展资料:SVN指南手册 | SVN

Guess you like

Origin blog.csdn.net/weixin_42839065/article/details/131315524