创建、合并svn的分支到主干(linux命令)

简易:

一、查看分支信息

     当然合并之前必须把目标分支download下来!!!

     将目录cd到分支目录(branch)
   1.运行svn info:
       唯一有用的信息:URL(分支svn地址)
svn://192.168.1.80:3698/C/branches/pirate/rpcfw/specialactivety
   2.运行   
 svn log --verbose --stop-on-copy | tail -10
       唯一有用的是:分支创建时的版本号(r17888)
二、合并分之到主干
      将目录cd到主干目录(trunk)
    1.  运行svn update:
         查看版本 库的的最新版本号(18665)
    2.运行svn merge:
svn merge svn://127.0.0.1/repos/main
或 
svn merge -r 17888:18665 svn://192.168.1.80:3698/C/branches/pirate/rpcfw/specialactivety
        —左侧:初始版本树
       —右侧:目标版本树
        弹出很多选项,选择postpone延迟冲突解决
   3.svn revert:
        如果merge出现错误revert可以撤销merge
三、解决冲突
     1.运行svn status:查看合并的信息
     2.有冲突的文件会生成四个文件         
 filename.merge-left.r18665
              filename.merge-right.r17888 
              filename.working
              filename
     3.修改filename文件中的冲突部分
     4.运行svn resolved filename删除生成的冗余文件
     5.提交 commit
  
svn commit -m "test"   //提交  
四、创建分支命令:
  到主目录的上层目录--》添加main文件夹: svn add ./dev
  创建分支:svn   copy   svn://127.0.0.1/repos/dev   svn://127.0.0.1/repos/branch -m "test"
  查看状态:svn log -v  ./branch/test.php
注意:

a),创建分支,只能在同一个仓库内进行,跨仓库是不行的。会提示      : 

   svn: No repository found in 'svn://127.0.0.1'

b),创建分支时,注意加上注释,不然会报以下错误。

[root@BlackGhost repos]# svn cp svn://127.0.0.1/repos/main svn://127.0.0.1/repos/branch
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
 
 

猜你喜欢

转载自www.cnblogs.com/cww0814/p/8966557.html