将源从分支合并到主干.用分支改变主干 [英] Merge sources from branch to trunk. Change trunk with branch

查看:43
本文介绍了将源从分支合并到主干.用分支改变主干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要合并从分支到主干的更改.
并且自创建分支以来,我们不需要在主干中所做的任何更改.
1.我们不需要合并源 - 我们需要用分支中的源替换主干中的源.2.我们不需要在trunk中创建但在branch中不存在(或在branch中被删除)的文件和目录.

在这种情况下如何合并源会更好?

现在我有主干和分支 b1:
http://svnhost/svn/mtest/trunk
http://svnhost/svn/mtest/branches/b1

  1. 我可以将主干移动到某些分支目录并将分支 b1 移动到主干:

    svn move http://svnhost/svn/mtest/trunkhttp://svnhost/svn/mtest/branches/branch4trunk
    svn 复制 http://svnhost/svn/mtest/branches/b1 http://svnhost/svn/mtest/trunk

  2. 我可以删除主干中所有不需要的文件和目录,然后将分支合并到主干

    svn co <​​a href="http://svnhost/svn/mtest/trunk" rel="nofollow noreferrer">http://svnhost/svn/mtest/trunk
    cd 后备箱
    svn 合并 --reintegrate http://svnhost/svn/mtest/branches/b1

    是否可以强制不合并文件而是替换它们?

在这些情况下有什么陷阱吗?
我们使用 Subversion 1.5

我不喜欢第一种情况,因为我需要将 SVN 源复制到 MKS 存储库.
当这些文件从 SVN 存储库中删除时,我们的工具会自动从 MKS 存储库中删除这些文件.
但是,如果我将分支移动到主干,则不会对此类文件进行任何操作.
所以我必须手动从 MKS 存储库中删除很多文件.
这不是一个好主意:(
我想修改/添加或删除实际操作.

解决方案

我会这样做:

<前>svn co http://svnhost/svn/mtest/trunkCD后备箱svn 合并 http://svnhost/svn/mtest/trunk http://svnhost/svn/mtest/branches/b1

这就是说,采取使我从主干到分支的更改,并将它们应用到主干."

换句话说,告诉我将主干转换为分支的更改......并执行它们!"

We need to merge changes from branch to trunk.
And we do not need any changes that we did in trunk since branch was created.
1. We do not need to merge sources - we need to replace sources in trunk with sources in branch. 2. We do not need files and directories that was created in trunk but does not exist in branch(or was deleted in branch).

How it would be better to merge sources in this case?

For now I have trunk and branch b1:
http://svnhost/svn/mtest/trunk
http://svnhost/svn/mtest/branches/b1

  1. I can move trunk to some branches directory and move branch b1 to trunk:

    svn move http://svnhost/svn/mtest/trunk http://svnhost/svn/mtest/branches/branch4trunk
    svn copy http://svnhost/svn/mtest/branches/b1 http://svnhost/svn/mtest/trunk

  2. I can remove all not needed files and directories in trunk an then merge branch to trunk

    svn co http://svnhost/svn/mtest/trunk
    cd trunk
    svn merge --reintegrate http://svnhost/svn/mtest/branches/b1

    Bit is it possible to force do not merge files but replace them?

Are there any pitfalls in these cases?
We use Subversion 1.5

I do not like the first case because I need to replicate SVN sources to MKS repository.
Our tools automatically removes files from MKS repository when such files was removed from SVN repository.
But if I move branch to trunk there will not be any actions about such files.
So I have to manually remove a lot of files from MKS repository.
It is not a good idea :(
I would like to have real actions modified/added or removed.

解决方案

I would do it like this:

svn co http://svnhost/svn/mtest/trunk
cd trunk
svn merge http://svnhost/svn/mtest/trunk http://svnhost/svn/mtest/branches/b1

This is saying, "take the changes that get me from trunk to branch, and apply them to the trunk."

In other words, "tell me the changes that would transform trunk into branch...and do them!"

这篇关于将源从分支合并到主干.用分支改变主干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆