[DEV] SVN常用命令

svn官网 http://subversion.apache.org/

svn help xxx 查看命令帮助

 

1.无分支流程

svn co http://.../trunk 获取代码

cd trunk 进行开发

svn st(文件级别)查看本地与缓存版本差异

svn log -v url (文件级别) 比较线上更新

svn diff (代码级别)比较A/B差异,如svn diff -r head比较线上更新

svn ci trunk -m "" 提交代码

svn update 更新本地

其他:目录复制后,删除复制出的目录下.svn,以避免异常

 

2.有分支流程

相对于无分支流程下的svn ci,有分支流程分解为主干到分支、分支到主干的过程,还可以进行多任务并行开发(最后merge)。

usage:   1. merge SOURCE[@REV] [TARGET_WCPATH] (the 'complete' merge)

              2. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH] (the 'cherry-pick' merge)

              3. merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH] (the '2-URL' merge)

              1全体合并;2截段合并;3多支合并。

src/tar:svn merge SOURCE[@REV] [TARGET_WCPATH]. SOURCE is usually a URL, TARGET_WCPATH is a working copy path. Normally SOURCE and TARGET_WCPATH should each correspond to the root of a branch.

REV:SOURCE is usually a URL. The optional '@REV' specifies both the peg revision of the URL and the latest revision that will be considered for merging; if REV is not specified, the HEAD revision is assumed. If SOURCE is a working copy path, the corresponding URL of the path is used, and the default value of 'REV' is the base revision (usually the revision last updated to).

catch-up/reintegrate:A merge from the parent branch to the feature branch is called a 'sync' or 'catch-up' merge, and a merge from the feature branch to the parent branch is called a 'reintegrate' merge.

issue:if merge r1:r2,but tar is already r2+1 (冲突检测与解决,r2=head is better)

 

1)创建分支,获取分支,进行开发,查看修改,提交修改到分支

    svn cp http://.../trunk  http://.../branch/brch_name -m ""

    svn co http://.../branch/brch_name

    cd brch_name

    svn st、diff

    svn ci brch_name -m ""

2)更新主干到分支

    查看版本,cd branch,svn log --stop-on-copy,最后一条记录就是创建分支时的版本

    (参考 http://zccst.iteye.com/blog/1430823)

    svn merge -r v1:v2 http://.../trunk

    (v1: version on copy, v2: latest version as HEAD,e.g. svn merge -27:HEAD http://.../trunk)

    svn status、diff

    svn ci brch_name -m ""

3)合并分支到主干

    cd trunk

    svn merge -r v1:v2 http://.../branches/brch_name

    svn status、diff

    svn ci trunk -m ""

4)维护分支

    更新分支,即继续步骤(2)

    或删除分支,svn rm http://.../branch/brch_name

5)建立tags,发布版本

    svn copy http://.../trunk http://.../tags/release-1.0 -m "1.0 released"

 

参考链接

https://blog.csdn.net/bbirdsky/article/details/24620155

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值