svn基本使用
1. 创建版本库:
2. 修改配置文件
Auth文件
Passwd文件
Svnserve.conf文件
注意:要去掉前面的空格不然会报,认证配置失败
3. 启动:
4. 创建目录
5. 导入项目:
6. 导出项目开发:
7. 进入目录就可以进行开发操作了
Svn log new.txt
其它一些命令:
Svn中分支的使用
1. 创建分支
也可以通过 TortoiseSVN 中的Branch/tag来创建分支
2. 取出分支来开发
3. 开发完成后向主干提交
检查需要合并的分支的历史:
合并:
检查冲突:
svn status
如果有解决冲突,没有就svn commit命令就可以完成提交
====2011.04.10
1. 批量增加svn文件
2. 批量增加svn:ignore属性
1. 创建版本库:
- Svnadmin create repos
Svnadmin create repos
2. 修改配置文件
Auth文件
- [groups]
- admin=shguo
- [/]
- @admin=rw
- *=r
[groups]
admin=shguo
[/]
@admin=rw
*=r
Passwd文件
- [users]
- shguo=shguo
[users]
shguo=shguo
Svnserve.conf文件
- anon-access = read
- auth-access = write
- password-db = passwd
- authz-db = authz
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
注意:要去掉前面的空格不然会报,认证配置失败
3. 启动:
- svnserve –d –r repos
svnserve –d –r repos
4. 创建目录
- Svn mkdir svn://127.0.0.1/repos/ -m “mkdir”
- Svn mkdir svn://127.0.0.1/repos/sns/ -m “mkdir”
- Svn mkdir svn://127.0.0.1/repos/sns/trunk -m “mkdir”
- Svn mkdir svn://127.0.0.1/repos/sns/branches -m “mkdir”
- Svn mkdir svn://127.0.0.1/repos/sns/tags -m “mkdir”
Svn mkdir svn://127.0.0.1/repos/ -m “mkdir”
Svn mkdir svn://127.0.0.1/repos/sns/ -m “mkdir”
Svn mkdir svn://127.0.0.1/repos/sns/trunk -m “mkdir”
Svn mkdir svn://127.0.0.1/repos/sns/branches -m “mkdir”
Svn mkdir svn://127.0.0.1/repos/sns/tags -m “mkdir”
5. 导入项目:
- Svn import sns svn://127.0.0.1/repos/sns/trunk/ –m “init project”
- 查看:svn list svn://127.0.0.1/repos/sns/trunk/
Svn import sns svn://127.0.0.1/repos/sns/trunk/ –m “init project”
查看:svn list svn://127.0.0.1/repos/sns/trunk/
6. 导出项目开发:
- Svn checkout svn://127.0.0.1/repos/sns/trunk/ sns
Svn checkout svn://127.0.0.1/repos/sns/trunk/ sns
7. 进入目录就可以进行开发操作了
- Cd sns
- Svn status
- Svn add new.txt
- Svn commit –m ‘commit’
Cd sns
Svn status
Svn add new.txt
Svn commit –m ‘commit’
Svn log new.txt
其它一些命令:
- Svn update
- Svn diff –r m:n path
- Svn lock some.java or svn unlock some.java
- Svn revert
- Svn add /delete / copy / move
- Svn switch –relocate svn://xxxx/one svn://xxxx/two
- Svn list path
Svn update
Svn diff –r m:n path
Svn lock some.java or svn unlock some.java
Svn revert
Svn add /delete / copy / move
Svn switch –relocate svn://xxxx/one svn://xxxx/two
Svn list path
Svn中分支的使用
1. 创建分支
- Svn cp
- http://svn.shguo.com/repos/sns/trunk/ http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
- -m “shguo_branch”
Svn cp
http://svn.shguo.com/repos/sns/trunk/ http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
-m “shguo_branch”
也可以通过 TortoiseSVN 中的Branch/tag来创建分支
2. 取出分支来开发
- Svn co
- http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
- 101128_sns_imageUpload_shguo
Svn co
http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
101128_sns_imageUpload_shguo
3. 开发完成后向主干提交
检查需要合并的分支的历史:
- http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
svn log --stop-on-copy -q
http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
合并:
- 16:HEAD
- http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
svn merge –r
16:HEAD
http://svn.shguo.com/repos/sns/branches/101128_sns_imageUpload_shguo
检查冲突:
svn status
如果有解决冲突,没有就svn commit命令就可以完成提交
====2011.04.10
1. 批量增加svn文件
- svn add `svn st |grep ? |awk '{print $2}'`
- svn st |grep ? |awk '{print $2}' |xargs svn add
svn add `svn st |grep ? |awk '{print $2}'`
svn st |grep ? |awk '{print $2}' |xargs svn add
2. 批量增加svn:ignore属性
- svn propset svn:ignore -F ~/.svnignore -R /app/work/app1
感觉复制过来效果不好样,贴个出处:http://yidianfengfan.iteye.com/blog/829713 觉得有用,看不太清楚的可以去这里看。