一聚教程网:一个值得你收藏的教程网站

热门教程

centos中SVN使用操作技巧

时间:2022-06-30 21:25:50 编辑:袖梨 来源:一聚教程网

SVN 分支合并修改合并到主干上

在主干分支上执行下面命令

$ svn merge --reintegrate 分支URL/album_mdl.php
--- Merging differences between repository URLs into 'album_mdl.php':
U    album_mdl.php
--- Recording mergeinfo for merge between repository URLs into 'album_mdl.php':
 U   album_mdl.php

SVN 创建分支

执行一下命令可以创建一个分支。

$ svn cp -m 'create new branch for dev' http://主干地址 http://分支地址

SVN删除分支

$ svn rm http://分支地址 -m 'delete the dev branch'

SVN分支同步主干最新内容

需要在分支目录中执行如下命令

$ svn merge http://主干地址

SVN回滚缓存的改变

$ svn revert . -R

SVN 替换服务地址

$ svn switch --relocate 原仓库ROOT地址  新仓库ROOT地址

实现SVN内容同步更新,当进行文件提交的时候,自动将提交的内容更新到另一个位置。
如同步更新到Web服务器以实现即时发布。

在仓库目录下的 hooks文件夹下,建立post-commit.bat文件。

@echo off
"D:\Program Files\VisualSVN\bin\svn.exe" update "E:\BaiDuYun\备份资料\SVN备份" –username testuser –password testpwd

如果出现文件只读等错误,则需要修改Svn服务器的执行权限。
在服务中的SVN服务中修改SVN的登陆身份为administrator即可

清除目录下所有的.svn文件

find . -type d -name ".svn"|xargs rm -fr

该命令中,-type用于指定查找的文件类型,d为目录类型(如果为f则为标准文件),-name指定查找的文件名称为.svn。
xargs命令将find查找到的列表按照每一行分成一段,对每一段执行rm -fr命令。

对于xargs命令的使用,可以举个例子,创建文件touchlist.txt,文件内容如下:

file1
file2
file3
file4

执行命令cat touchlist.txt|xargs touch,可以看到,当前目录下自动创建了如下文件:

localhost:test mylxsw$ ll
total 8
-rw-r--r--  1 mylxsw  staff   0  9 12 11:56 file1
-rw-r--r--  1 mylxsw  staff   0  9 12 11:56 file2
-rw-r--r--  1 mylxsw  staff   0  9 12 11:56 file3
-rw-r--r--  1 mylxsw  staff   0  9 12 11:56 file4
-rw-r--r--  1 mylxsw  staff  24  9 12 11:55 touchlist.txt

要清理目录下所有指定的文件,可以使用命令find . -type f -name "*.xml" -print0|xargs -0 rm -fr,该命令解决了文件名中包含空格而出现的xargs: unterminated quote错误。

移动指定目录下指定类型的文件

# find . -name "*.mkv"|xargs -I {} mv {} /dest/

热门栏目