SVN-如何将在主干中所做的更改应用于所有分支 [英] SVN - how to apply change made in trunk to all branches
问题描述
我是SVN的初学者.我具有SVN目录结构,如下所示:
I am a beginner in SVN.I have the SVN directory structure like this:
|-trunk
|-file1.php
|-file2.php
|-branches
|-branch_1
|-file1.php
|-file2.php
|-branch_2
|-file1.php
|-file2.php
在后备箱中,我具有应用程序的主版本.我有两个分支,分别用于不同的客户端,这些客户端仅在某些文件中有修改.当我发现一些核心错误时,将其修复在主干中.例如,我修改了trunk
目录中的file1.php
.我想对所有分支中名为file1.php
的文件应用更改.
In the trunk I have the main version of my application. I have two branches for different clients which have the modifications only in some files. When I find some core bug I fix it in trunk. For example I modified the file1.php
in trunk
directory. I want to apply changes to the files named file1.php
in all the branches.
我有点困惑.在具有Subversion的版本控制中,我找到了以下解释.>
I am little confused. In the Version Control with Subversion I have found the following explanation.
Subversion的存储库有一个特殊的 设计.复制目录时, 不用担心 存储库变得巨大—颠覆 实际上并没有重复任何数据. 而是创建一个新目录 指向现有树的条目.
Subversion's repository has a special design. When you copy a directory, you don't need to worry about the repository growing huge—Subversion doesn't actually duplicate any data. Instead, it creates a new directory entry that points to an existing tree.
所以我虽然在文件trunk\file1.php
中进行更改时会自动将其添加到其他file1.php
文件中,因为我没有对branches
目录中的文件进行任何更改.
So I though that when I commit a change in the file trunk\file1.php
it will be automaticaly aplied to the other file1.php
files as I didn't make any changes to that files in branches
directory.
如何将主干目录中的更改应用于所有分支?我试图像这样使用svn merge
:
svn merge -r 31:32 http://mysvnserver.com/project/branches/branch_1
但是我没有做任何更改(svn diff -r 31:32
返回我所做的所有更改.)
but I didn't do any changes (svn diff -r 31:32
returns all the changes I made.)
推荐答案
如果您要将更改从主干应用到branch_1,则merge命令需要指定从何处获取diff ,并且然后指定目标以将合并应用于:
If you want to apply a change from trunk to branch_1, the merge command needs to specify where to get the diff from, and then specify a target to apply the merge to:
cd branch_1
svn merge -r 31:32 http://mysvnserver.com/project/trunk .
svn diff # confirm that the only diff is your change to file1.php
svn commit
这篇关于SVN-如何将在主干中所做的更改应用于所有分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!