查看文件或者目录状态:

  1. [root@v01 ~]# svn status online/ #正常情况下没显示
  1. [root@v01 ~]# svn status online/ #如果有变动会有如下显示【?:不在svn的控制中;M:内容被修改;C:发生冲突;A:预定加入到版本库;K:被锁定】
  2. M online/index.html
  1. [root@v01 ~]# svn status -v online/ #svn status -v path(显示文件和子目录状态)
  2. 1 1 user001 online
  3. M 1 1 user001 online/index.html
  4. 第一列保持相同,第二列显示工作版本号,第三和第四列显示最后一次修改的版本号和修改人。
  5.   注:svn statussvn diff svn revert这三条命令在没有网络的情况下也可以执行的,原因是svn在本地的.svn中保留了本地版本的原始拷贝。
  6. 简写:svn st

将改动的文件提交到版本库

  1. [root@v01 ~]# cd online/
  2. [root@v01 online]# ls
  3. index.html
  4. [root@v01 online]# svn commit -m "add test file for mytest" index.html
  5. Sending index.html
  6. Transmitting file data .
  7. Committed revision 2.
  1. [root@v01 ~]# svn status -v online/
  2. 1 1 user001 online
  3. 2 2 user001 online/index.html
  4. [root@v01 ~]# svn status online/
  5. [root@v01 ~]# 提交成功 客户段与服务端代码一致!
    svn commit -m LogMessage [-N] [--no-unlock] PATH(如果选择了保持锁,就使用–no-unlock开关)

加锁/解锁

  1. svn lock -m LockMessage [--force] PATH
  2. 例如:svn lock -m lock test file test.php
  3. svn unlock PATH

更新到某个版本

  1. svn update -r m path
  2. 例如:
  3. svn update如果后面没有目录,默认将当前目录以及子目录下的所有文件都更新到最新版本。
  4. svn update -r 200 test.php(将版本库中的文件test.php还原到版本200)
  5. svn update test.php(更新,于版本库同步。如果在提交的时候提示过期的话,是因为冲突,需要先update,修改文件,然后清除svn resolved,最后再提交commit)
  6. 简写:svn up

添加一个文件到工作拷贝:

  1. $ svn co http://host/myproject working_copy # Substitute for whatever URL you need to access your repository.
  2. $ cd working_copy
  3. $ mkdir sample
  4. $ svn add sample
  5. $ svn ci -m "Commit!"
  1. [root@v01 www]# cp authz webtest/
  2. [root@v01 www]# svn status webtest/
  3. ? webtest/authz
  4. [root@v01 www]# cd webtest/
  5. [root@v01 webtest]# ls
  6. authz index.html index.php
  7. [root@v01 webtest]# svn add authz
  8. A authz
  1. [root@v01 www]# svn add webtest/ index.html
  2. svn: '.' is not a working copy
  3. --------------------------------------------------------------------------
  4. [root@v01 www]# ll -all webtest/
  5. total 12
  6. drwxr-xr-x. 3 www www 4096 May 9 08:49 .
  7. dr-xr-xr-x. 5 www www 4096 May 9 08:49 ..
  8. drwxr-xr-x. 6 root root 4096 May 9 08:47 .svn
  9. [root@v01 webtest]# tree .
  10. .
  11. ├── index.html
  12. └── index.php
  13.  
  14. 0 directories, 2 files
  15. [root@v01 www]# cp index.{html,php} webtest/
  16. cp: overwrite `webtest/index.html'? y
  17. cp: overwrite `webtest/index.php'? y
  18. [root@v01 www]# svn status -v webtest/
  19. 0 0 ? webtest
  20. A 0 ? ? webtest/index.html
  21. A 0 ? ? webtest/index.php
  22. [root@v01 www]# svn status webtest/
  23. A webtest/index.html
  24. A webtest/index.php
  1. [root@v01 webtest]# svn ci
  2. svn: Commit failed (details follow):
  3. svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
  4. svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found
  1. 追加到/etc/bashrc
  2. export SVN_EDITOR=vim
  1. [root@v01 webtest]# source /etc/bashrc
  2. [root@v01 webtest]# svn ci
  3. sh: vim: command not found
  4. svn: Commit failed (details follow):
  5. svn: system('vim svn-commit.tmp') returned 32512
  1. [root@v01 webtest]# svn ci
  2.  
  3. Log message unchanged or not specified
  4. (a)bort, (c)ontinue, (e)dit:
  5. c
  6. Authentication realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73
  7. Password for 'root':
  8. Authentication realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73
  9. Username: user01
  10. Password for 'user01':
  11.  
  12. -----------------------------------------------------------------------
  13. ATTENTION! Your password for authentication realm:
  14.  
  15. <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73
  16.  
  17. can only be stored to disk unencrypted! You are advised to configure
  18. your system so that Subversion can store passwords encrypted, if
  19. possible. See the documentation for details.
  20.  
  21. You can avoid future appearances of this warning by setting the value
  22. of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
  23. '/root/.subversion/servers'.
  24. -----------------------------------------------------------------------
  25. Store password unencrypted (yes/no)? yes
  26. Adding index.html
  27. Adding index.php
  28. Transmitting file data ..
  29. Committed revision 1.
  1. [root@v01 webtest]# echo "hello world" >> index.html
  2. [root@v01 webtest]# svn status
  3. ? svn-commit.tmp
  4. M index.html
  5. [root@v01 webtest]# svn ci
  6.  
  7. Log message unchanged or not specified
  8. (a)bort, (c)ontinue, (e)dit:
  9. c
  10. Sending index.html
  11. Transmitting file data .
  12. Committed revision 3.

查看日志:

  1. svn log path
  2. 例如:svn log test.php 显示这个文件的所有修改记录,及其版本号的变化
  3. [root@v01 webtest]# svn log index.html
  4. ------------------------------------------------------------------------
  5. r3 | user01 | 2016-05-09 11:40:24 +0800 (Mon, 09 May 2016) | 1 line
  6.  
  7. ------------------------------------------------------------------------
  8. r2 | user01 | 2016-05-09 11:39:21 +0800 (Mon, 09 May 2016) | 1 line
  9.  
  10. ------------------------------------------------------------------------
  11. r1 | user01 | 2016-05-09 11:33:04 +0800 (Mon, 09 May 2016) | 1 line
  12.  
  13. -----------------------------------------------------------------------

查看文件详细信息
svn info path
例如:svn info test.ph

  1. [root@v01 webtest]# svn info index.html
  2. Path: index.html
  3. Name: index.html
  4. URL: svn://192.168.1.89/webtest/index.html
  5. Repository Root: svn://192.168.1.89/webtest
  6. Repository UUID: 18ab87c6-8455-4174-a313-7b6fd3775a73
  7. Revision: 3
  8. Node Kind: file
  9. Schedule: normal
  10. Last Changed Author: user01
  11. Last Changed Rev: 3
  12. Last Changed Date: 2016-05-09 11:40:24 +0800 (Mon, 09 May 2016)
  13. Text Last Updated: 2016-05-09 11:40:03 +0800 (Mon, 09 May 2016)
  14. Checksum: 6f9361a19c3f7bb3c06d0fdadbfe479b

比较差异
svn diff path(将修改的文件与基础版本比较)
例如:svn diff test.php
svn diff -r m:n path(对版本m和版本n比较差异)
例如:svn diff -r 200:201 test.php
简写:svn di

  1. [root@v01 webtest]# svn di -r 1:3 index.html
  2. Index: index.html
  3. ===================================================================
  4. --- index.html (revision 1)
  5. +++ index.html (revision 3)
  6. @@ -1 +1,2 @@
  7. -testweb
  8. +kkkkkkkkkkktestweb
  9. +hello world
  10.  
  11. [root@v01 webtest]# svn di -r 1:2 index.html
  12. Index: index.html
  13. ===================================================================
  14. --- index.html (revision 1)
  15. +++ index.html (revision 2)
  16. @@ -1 +1 @@
  17. -testweb
  18. +kkkkkkkkkkktestweb
  19. [root@v01 webtest]# svn di -r 2:3 index.html
  20. Index: index.html
  21. ===================================================================
  22. --- index.html (revision 2)
  23. +++ index.html (revision 3)
  24. @@ -1 +1,2 @@
  25. kkkkkkkkkkktestweb
  26. +hello world
  27. [root@v01 webtest]#

linux svn客户端 常用命令的更多相关文章

  1. SVN客户端常用命令

    1. 将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如: cd /home/www  #进入准备获取的项目路径 svn checkout svn: ...

  2. linux svn 客户端基本使用命令

    1.从svn获取项目 svn co URL --username XX --password XX; 2.添加code file svn add codeFile; svn ci -m "c ...

  3. Linux查看系统配置常用命令

    Linux查看系统配置常用命令: 系统 # uname -a # 查看内核/操作系统/CPU信息# head -n 1 /etc/issue # 查看操作系统版本# cat /proc/cpuinfo ...

  4. linux vi编辑常用命令

      linux vi编辑常用命令 来源:互联网 作者:佚名 时间:07-10 21:31:14 [大 中 小] linux vi编辑常用命令,需要的朋友可以参考下   vi编辑器中有三种状态模式 1. ...

  5. Linux 系统巡检常用命令

    Linux系统巡检常用命令   # uname -a # 查看内核/操作系统# cat /etc/centos-release # 查看centos操作系统版本# cat /proc/cpuinfo ...

  6. linux 下 mysql 常用命令

    linux 下 mysql 常用命令   阅读目录 ====================== 1.开启和关闭 1.1.开启 1.2.关闭 1.3.重启 2.登录 2.1.密码明文 2.2.密码密文 ...

  7. linux:终端常用命令 + vi命令修改文件及保存 方法

    首先介绍一下Ubuntu下各个目录的一般作用: /  这就是根目录,一台电脑有且只有一个根目录,所有的文件都是从这里开始的.举个例子:当你在终端里输入“/home”,你其实是在告诉电脑,先从/(根目录 ...

  8. Linux学习之CentOS(二)--初识linux的一些常用命令

    Linux学习之CentOS(二)--初识linux的一些常用命令 在VM上安装完了CentOS6.4以后,看着linux系统成功跑起来,心里小激动了一把......但是前方学习的道路还很遥远... ...

  9. Apache RocketMQ在linux上的常用命令

    Apache RocketMQ在linux上的常用命令 进入maven安装后的rocketmq的bin目录  1.启动Name Server  2.启动Broker 3.关闭Name Server 4 ...

随机推荐

  1. tmux 快捷键

    ctrl+b , 修改窗口名称 ctrl+b ' 快速按名字切换窗口 ctrl+b w 列出窗口列表 Ctrl+b 激活控制台:此时以下按键生效 系统操作 ? 列出所有快捷键:按q返回 d 脱离当前会 ...

  2. JS小记

    好记性不如烂笔头. 1.document.ElementFromPoint:根据坐标获得元素 2.有时候要操作DOM页面,但是得不到预期结果,很可能是因为页面还没加载完成,在console控制台可以看 ...

  3. 分子量 (Molar Mass,ACM/ICPC Seoul 2007,UVa 1586)

    解题思路: 1.将分子量用double 数组记录下来 2.将字符串存储在字符数组中,从头向后扫描,一直记住“字母”,对下一个字符进行判断,是否是数字,如果是数字:用一个整数记录,本代码中用的sum,同 ...

  4. 关于使用客户端控件和jquery上传文件

    一.导入Jquery插件ajaxfileupload.js 下载地址:http://www.phpletter.com/Demo/AjaxFileUpload-Demo/ 使用方法: $.ajaxFi ...

  5. CentOS7 最小化安装后启用无线连接网络

    1.ip addr 找到自己的无线网接口 (ps:本人的是wlp2s0) 2.ip link set wlp2s0 up 打开无线网的驱动 3.ip link show wlp2s0 查看该网络接口的 ...

  6. win7下搭建PHP环境

    一.安装软件 1.apache下载地址:http://httpd.apache.org/download.cgi 2.php下载地址:http://windows.php.net/download/ ...

  7. 图论&数据结构——并查集

    Wikioi 4246 NOIP模拟赛Day2T1 奶牛的身高  题目描述 Description 奶牛们在FJ的养育下茁壮成长.这天,FJ给了奶牛Bessie一个任务,去看看每个奶牛场中若干只奶牛的 ...

  8. Mac OS X【快捷键组合】汇总

    以下是可能会出现在 OS X 菜单中的修饰键符号: ⌘—— () ⌃ ——Control ⌥—— (alt) ⇧——Shift ⇪——Caps Lock fn——功能键就是fn 启动快捷键 按下按键 ...

  9. 在Android的webview中定做js的alert,confirm和prompt对话框的方法

    在Android的webview中定制js的alert,confirm和prompt对话框的方法 http://618119.com/archives/2010/12/20/199.html 1.首先 ...

  10. SSH 内网端口转发实战

    导读 大家都知道SSH是一种安全的传输协议,用在连接服务器上比较多.不过其实除了这个功能,它的隧道转发功能更是吸引人. 如果两个内网之间的linux服务器需要互相登录,或需要互相访问内网某个端口,担忧 ...