日常开发中使用到的Svn基本操作
svn
1. 检出项目
svn checkout path(服务器上的目录)
简写 : snv co
同时将多个项目检出放置到一个目录中
svn co file:///var/svn/repos/test file:///var/svn/repos/quiz working-copies 说明: 使用反斜线隔开要检出的项目
常用参数:
--username: 指定用户名称 --username=x-wolf
--password:指定用户密码 --password=123456
--no-auth-cache:不存储用户验证信息 --no-auth-cache
2. 添加新的文件
svn add file
3.更新到某个版本
svn update -r 版本号 path+file (回滚到某个版本)
简写: svn up
4.查看文件或目录的状态
1) svn status path
2) svn status -v path
简写:svn st
5.删除文件
svn delete path -m 'delete test file'
6.查看日志
svn log path
svn log -l 3 // 查看最近3条数据
7.查看svn信息
svn info
8.比较差异
svn diff -r 200:201 file # 版本200 和 201 比较
9.提交版本库
svn commit -m "comment"
10.合并
svn merge -r v1:v2 path
11.查看帮助
svn help
常见问题:
1. 在检出项目的时候总提示这个信息
Warning: post-commit hook failed (exit code 1) with output: ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: lxy 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 '/home/svn/.subversion/servers'. ----------------------------------------------------------------------- Store password unencrypted (yes/no)?
解决: 设置--no-auth-cache参数即可
2. Can't use Subversion command line client: svn
安装svn的时候需要安装对应的终端工具
1). 重新安装
2)选择modify
3)之后会看到command line client tools前面是个叉
4) 点下叉,选择Entire feature will be installed on local hard drive