To view the status of a file or directory:
[[Email protected] ~]# SVN status online/#正常情况下没显示
[Email protected] ~]# SVN status online/ #如果有变动会有如下显示 "? : Not in SVN control; m: Content modified; C: conflict; A: Scheduled to be added to the repository; K: Locked "M
[[Email protected] ~]# svn status-v online/#svn status-v path (show file and subdirectory status) 1 1 user001 onlinem 1 1 u ser001 online/index.html The first column remains the same, the second column shows the work version number, and 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, because SVN retains the original copy of the local version in. svn. Shorthand: SVN St
submit the modified file to the repository :
[[Email protected] ~]# CD Online/[[email protected] online]# lsindex.html[[email protected] online]# svn commit-m "Add te St file for mytest "index.html sending index.htmltransmitting file data. Committed Revision 2.
[[Email protected] ~]# svn status-v online/ 1 1 user001 online 2 2 user001 online/index.html[ [Email protected] ~]# SVN status Online/[[email protected] ~]# submit a successful customer segment consistent with the service-side code!
SVN commit-m "LogMessage" [-n] [--no-unlock] PATH (use –no-unlock switch if hold lock is selected)
locking/Unlock :
SVN lock-m "Lockmessage" [--force] path example: SVN lock-m "lock test file" TEST.PHPSVN unlock Path
update to a version :
SVN update-r m path for example: SVN update if there is no directory behind it, the default is to update all files in the current directory and subdirectories to the latest version. SVN update-r test.php (Restore files from the repository test.php to version) SVN update test.php (update, sync to Repository. If the prompt expires at the time of submission, it is because of the conflict, you need to update, modify the file, then clear the SVN resolved, and then commit the commit) shorthand: svn up
Add a file to the working copy:
$ svn Co http://host/myproject working_copy # Substitute for whatever URL-need to access your repository.$ CD working_copy$ mkdir sample$ svn add sample$ svn ci-m "commit!"
[email protected] www]# CP Authz webtest/[[email protected] www]# svn status webtest/? Webtest/authz[[email protected] www]# CD Webtest/[[email protected] webtest]# lsauthz index.html index.php[[ Email protected] webtest]# svn add authz A Authz
[[Email protected] www]# svn add webtest/index.html svn: '. ' is not a working copy--------------------------------------- -----------------------------------[[email protected] www]# ll-all webtest/total 12drwxr-xr-x. 3 www www 4096 may 9 08:49 dr-xr-xr-x. 5 www www 4096 may 9 08:49. Drwxr-xr-x. 6 root root 4096 may 9 08:47 svn[[email protected] webtest]# tree. ├──index.html└──index.php0 directories, 2 Files[[email protected] www]# CP index. {html,php} webtest/cp:overwrite ' webtest/index.html '? Ycp:overwrite ' webtest/index.php '? Y[[email protected] www]# svn status-v webtest/ 0 0 ? Webtesta 0 ? ? Webtest/index.htmla 0 ? ? Webtest/index.php[[email protected] www]# svn status webtest/a webtest/index.htmla webtest/ index.php
[[Email protected] webtest]# svn ci svn:commit failed (details follow): Svn:could not use external editor to fetch log me Ssage; Consider setting the $SVN _editor environment variable or using the--message (-m) or--file (-f) Optionssvn:none of the E Nvironment variables Svn_editor, VISUAL or EDITOR is set, and no ' editor-cmd ' run-time configuration option was found
Append to/etc/bashrcexport Svn_editor=vim
[Email protected] webtest]# SOURCE/ETC/BASHRC [[email protected] webtest]# svn ci sh:vim:command not Foundsvn:commit Failed (Details follow): Svn:system (' Vim svn-commit.tmp ') returned 32512
[[email protected] webtest]# SVN cilog message unchanged or not specified (a) bort, (c) ontinue, (e) dit: Cauthentication Realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73password for ' root ': Authentication Realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73username:user01password For ' User01 ':-----------------------------------------------------------------------attention! Your Password for authentication realms: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73can only be stored to disk unencrypted! You is advised to Configureyour system so that Subversion can store passwords encrypted, ifpossible. See the documentation for details. You can avoid future appearances of this warning by setting the valueof ' option to Store-plaintext-passwords ' Yes ' or ' no ' in '/root/.subversion/servers '.---------------------------------------------------------------------- -store Password unencrypted (yes/no)? Yesadding index.htmladding index.phptransmitting File Data: Committed Revision 1.
[Email protected] webtest]# echo "Hello World" >> index.html [[email protected] webtest]# SVN status? SVN-COMMIT.TMPM index.html[[email protected] webtest]# SVN cilog message unchanged or not specified (a) bort, (c) Ontinue, (e) dit:csending index.htmltransmitting file data. Committed Revision 3.
To view logs:
SVN log Path example: SVN log test.php shows all the changes to this file, and its version number [[email protected] webtest]# SVN log Index.html------------------------------------------------------------------------R3 | User01 | 2016-05-09 11:40:24 +0800 (Mon, 2016) | 1 Line------------------------------------------------------------------------R2 | User01 | 2016-05-09 11:39:21 +0800 (Mon, 2016) | 1 Line------------------------------------------------------------------------R1 | User01 | 2016-05-09 11:33:04 +0800 (Mon, 2016) | 1 line-----------------------------------------------------------------------
View File Details
SVN info Path
Example: SVN info test.ph
[[Email protected] webtest]# SVN info index.html path:index.htmlname:index.htmlurl:svn://192.168.1.89/webtest/ Index.htmlrepository root:svn://192.168.1.89/webtestrepository uuid:18ab87c6-8455-4174-a313-7b6fd3775a73revision : 3Node Kind:fileSchedule:normalLast Changed author:user01last Changed rev:3last Changed date:2016-05-09 11:40:24 +08 XX (Mon, 11:40:03) Text last updated:2016-05-09-+0800 (Mon, May) checksum:6f9361a19c3f7bb3c06d0fdadbfe 479b
Compare Differences
SVN diff path (compares the modified file to the base version)
Example: SVN diff test.php
SVN diff-r m:n Path (difference between version m and version N)
Example: SVN diff-r 200:201 test.php
Shorthand: SVN di
[Email protected] webtest]# svn di-r 1:3 index.html index:index.html================================================ ===================---index.html (Revision 1) + + index.html (Revision 3) @@-1 +1,2 @@-testweb+kkkkkkkkkkktestweb+hello World[[email protected] webtest]# svn di-r 1:2 index.html index:index.html=========================================== ========================---index.html (Revision 1) + + index.html (revision 2) @@-1 +1 @@-testweb+ Kkkkkkkkkkktestweb[[email protected] webtest]# svn di-r 2:3 index.html index:index.html============================== =====================================---index.html (revision 2) + + + index.html
Linux SVN client common commands