linux svn客户端 常用命令
查看文件或者目录状态:
[root@v01 ~]# svn status online/ #正常情况下没显示
[root@v01 ~]# svn status online/ #如果有变动会有如下显示【?:不在svn的控制中;M:内容被修改;C:发生冲突;A:预定加入到版本库;K:被锁定】
M online/index.html
[root@v01 ~]# svn status -v online/ #svn status -v path(显示文件和子目录状态)
1 1 user001 online
M 1 1 user001 online/index.html
第一列保持相同,第二列显示工作版本号,第三和第四列显示最后一次修改的版本号和修改人。
注:svn status、svn diff和 svn revert这三条命令在没有网络的情况下也可以执行的,原因是svn在本地的.svn中保留了本地版本的原始拷贝。
简写:svn st
将改动的文件提交到版本库:
[root@v01 ~]# cd online/
[root@v01 online]# ls
index.html
[root@v01 online]# svn commit -m "add test file for mytest" index.html
Sending index.html
Transmitting file data .
Committed revision 2.
[root@v01 ~]# svn status -v online/
1 1 user001 online
2 2 user001 online/index.html
[root@v01 ~]# svn status online/
[root@v01 ~]# 提交成功 客户段与服务端代码一致!
svn commit -m “LogMessage“ [-N] [--no-unlock] PATH(如果选择了保持锁,就使用–no-unlock开关)
加锁/解锁:
svn lock -m “LockMessage“ [--force] PATH
例如:svn lock -m “lock test file“ test.php
svn unlock PATH
更新到某个版本:
svn update -r m path
例如:
svn update如果后面没有目录,默认将当前目录以及子目录下的所有文件都更新到最新版本。
svn update -r 200 test.php(将版本库中的文件test.php还原到版本200)
svn update test.php(更新,于版本库同步。如果在提交的时候提示过期的话,是因为冲突,需要先update,修改文件,然后清除svn resolved,最后再提交commit)
简写:svn up
添加一个文件到工作拷贝:
$ svn co http://host/myproject working_copy # Substitute for whatever URL you need to access your repository.
$ cd working_copy
$ mkdir sample
$ svn add sample
$ svn ci -m "Commit!"
[root@v01 www]# cp authz webtest/
[root@v01 www]# svn status webtest/
? webtest/authz
[root@v01 www]# cd webtest/
[root@v01 webtest]# ls
authz index.html index.php
[root@v01 webtest]# svn add authz
A authz
[root@v01 www]# svn add webtest/ index.html
svn: '.' is not a working copy
--------------------------------------------------------------------------
[root@v01 www]# ll -all webtest/
total 12
drwxr-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
[root@v01 webtest]# tree .
.
├── index.html
└── index.php 0 directories, 2 files
[root@v01 www]# cp index.{html,php} webtest/
cp: overwrite `webtest/index.html'? y
cp: overwrite `webtest/index.php'? y
[root@v01 www]# svn status -v webtest/
0 0 ? webtest
A 0 ? ? webtest/index.html
A 0 ? ? webtest/index.php
[root@v01 www]# svn status webtest/
A webtest/index.html
A webtest/index.php
[root@v01 webtest]# svn ci
svn: Commit failed (details follow):
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
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found
追加到/etc/bashrc
export SVN_EDITOR=vim
[root@v01 webtest]# source /etc/bashrc
[root@v01 webtest]# svn ci
sh: vim: command not found
svn: Commit failed (details follow):
svn: system('vim svn-commit.tmp') returned 32512
[root@v01 webtest]# svn ci Log message unchanged or not specified
(a)bort, (c)ontinue, (e)dit:
c
Authentication realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73
Password for 'root':
Authentication realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73
Username: user01
Password for 'user01': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.89:3690> 18ab87c6-8455-4174-a313-7b6fd3775a73 can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Adding index.html
Adding index.php
Transmitting file data ..
Committed revision 1.
[root@v01 webtest]# echo "hello world" >> index.html
[root@v01 webtest]# svn status
? svn-commit.tmp
M index.html
[root@v01 webtest]# svn ci Log message unchanged or not specified
(a)bort, (c)ontinue, (e)dit:
c
Sending index.html
Transmitting file data .
Committed revision 3.
查看日志:
svn log path
例如:svn log test.php 显示这个文件的所有修改记录,及其版本号的变化
[root@v01 webtest]# svn log index.html
------------------------------------------------------------------------
r3 | user01 | 2016-05-09 11:40:24 +0800 (Mon, 09 May 2016) | 1 line ------------------------------------------------------------------------
r2 | user01 | 2016-05-09 11:39:21 +0800 (Mon, 09 May 2016) | 1 line ------------------------------------------------------------------------
r1 | user01 | 2016-05-09 11:33:04 +0800 (Mon, 09 May 2016) | 1 line -----------------------------------------------------------------------
查看文件详细信息
svn info path
例如:svn info test.ph
[root@v01 webtest]# svn info index.html
Path: index.html
Name: index.html
URL: svn://192.168.1.89/webtest/index.html
Repository Root: svn://192.168.1.89/webtest
Repository UUID: 18ab87c6-8455-4174-a313-7b6fd3775a73
Revision: 3
Node Kind: file
Schedule: normal
Last Changed Author: user01
Last Changed Rev: 3
Last Changed Date: 2016-05-09 11:40:24 +0800 (Mon, 09 May 2016)
Text Last Updated: 2016-05-09 11:40:03 +0800 (Mon, 09 May 2016)
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
[root@v01 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 [root@v01 webtest]# svn di -r 1:2 index.html
Index: index.html
===================================================================
--- index.html (revision 1)
+++ index.html (revision 2)
@@ -1 +1 @@
-testweb
+kkkkkkkkkkktestweb
[root@v01 webtest]# svn di -r 2:3 index.html
Index: index.html
===================================================================
--- index.html (revision 2)
+++ index.html (revision 3)
@@ -1 +1,2 @@
kkkkkkkkkkktestweb
+hello world
[root@v01 webtest]#
linux svn客户端 常用命令的更多相关文章
- SVN客户端常用命令
1. 将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如: cd /home/www #进入准备获取的项目路径 svn checkout svn: ...
- linux svn 客户端基本使用命令
1.从svn获取项目 svn co URL --username XX --password XX; 2.添加code file svn add codeFile; svn ci -m "c ...
- Linux查看系统配置常用命令
Linux查看系统配置常用命令: 系统 # uname -a # 查看内核/操作系统/CPU信息# head -n 1 /etc/issue # 查看操作系统版本# cat /proc/cpuinfo ...
- linux vi编辑常用命令
linux vi编辑常用命令 来源:互联网 作者:佚名 时间:07-10 21:31:14 [大 中 小] linux vi编辑常用命令,需要的朋友可以参考下 vi编辑器中有三种状态模式 1. ...
- Linux 系统巡检常用命令
Linux系统巡检常用命令 # uname -a # 查看内核/操作系统# cat /etc/centos-release # 查看centos操作系统版本# cat /proc/cpuinfo ...
- linux 下 mysql 常用命令
linux 下 mysql 常用命令 阅读目录 ====================== 1.开启和关闭 1.1.开启 1.2.关闭 1.3.重启 2.登录 2.1.密码明文 2.2.密码密文 ...
- linux:终端常用命令 + vi命令修改文件及保存 方法
首先介绍一下Ubuntu下各个目录的一般作用: / 这就是根目录,一台电脑有且只有一个根目录,所有的文件都是从这里开始的.举个例子:当你在终端里输入“/home”,你其实是在告诉电脑,先从/(根目录 ...
- Linux学习之CentOS(二)--初识linux的一些常用命令
Linux学习之CentOS(二)--初识linux的一些常用命令 在VM上安装完了CentOS6.4以后,看着linux系统成功跑起来,心里小激动了一把......但是前方学习的道路还很遥远... ...
- Apache RocketMQ在linux上的常用命令
Apache RocketMQ在linux上的常用命令 进入maven安装后的rocketmq的bin目录 1.启动Name Server 2.启动Broker 3.关闭Name Server 4 ...
随机推荐
- TIME_WAIT过多
Linux系统下,TCP/IP连接断开后,会以TIME_WAIT状态保留一定的时间,然后才会释放端口.当并发请求过多的时候,就会产生大量的 TIME_WAIT状态的连接,无法及时断开的话,会占用大量的 ...
- 锋利的jQuery-4--图片切换的一个例子(自己理解后写的,以备忘记时看看)
一个动画切换的效果,如图: 分析步骤: 1.点击左右的箭头图片滚动,左边的小点变化. 2.主要问题是当滚到最后一屏时切换回第一屏,第一屏在向前滚动是切换到最后一屏 :通过判断图片的总数然后除以每屏显示 ...
- SSH协议及其应用
SSH协议及其应用 原文作者:阮一峰 链接: http://www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html http://www.ruany ...
- memcache 缓存的批量删除方案(转)
memcache 默认只支持使用delete(key)和 flush_all,这两种方法都太极端了,不能满足用户的特定需求,如:批量删除‘aaaaaaaa_’开头的所有缓存,这个时候该怎么办? 1 g ...
- iOS ASIHTTPRequest用https协议加密请求
iOS 终端请求服务端数据时,为了保证数据安全,我们一般会使用https协议加密,而对于iOS的网络编程,我们一般会使用开源框架:ASIHTTPRequest,但是如果使用传统的http方式,即使忽略 ...
- iOS-使用Xcode拉伸图片
如果要制作一个类似于QQ消息气泡的图片,该如何制作呢?android中可以使用.9图片指定图片中的某一部分拉伸,那iOS中类似的功能要如何实现呢,Xcode提供了类似的功能.具体步骤如下: 1.选择需 ...
- gdb 多线程调试
gdb 多线程调试 http://hi.baidu.com/hcq11/blog/item/9f5bfc6e696209d680cb4a25.html http://hi.baidu.com/lit ...
- wordPress Development
site:http://codex.wordpress.org/Theme_Development 2014-03-24 This article is about developing WordPr ...
- Poj 3233 Matrix Power Series(矩阵二分快速幂)
题目链接:http://poj.org/problem?id=3233 解题报告:输入一个边长为n的矩阵A,然后输入一个k,要你求A + A^2 + A^3 + A^4 + A^5.......A^k ...
- 搭个 Web 服务器(一)
导读 我相信,如果你想成为一个更好的开发者,你必须对日常使用的软件系统的内部结构有更深的理解,包括编程语言.编译器与解释器.数据库及操作系统.Web 服务器及 Web 框架.而且,为了更好更深入地理解 ...