windows SVN:将本地更改合并到其他工作副本中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3564487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SVN: merge local changes into other working copy
提问by Mot
I have two working copies of the same project, each switched to a different branch. Is it possible to merge local changes in one project to the other working copy?
我有同一个项目的两个工作副本,每个都切换到不同的分支。是否可以将一个项目中的本地更改合并到另一个工作副本?
回答by reko_t
You can't merge two separate working copies, but there are some things you can do.
您不能合并两个单独的工作副本,但您可以做一些事情。
If the changes are made to existing files, the easiest way is to create a patch with svn diff
, and then just apply that patch to the other working copy. Eg. in the first working copy you do:
如果对现有文件进行了更改,最简单的方法是使用 来创建补丁svn diff
,然后将该补丁应用到另一个工作副本。例如。在第一个工作副本中,您执行以下操作:
svn diff > patch
And then you apply it in the other one:
然后你将它应用到另一个:
patch -p0 < patch
And as usual you want to run patch
with the --dry-run
option to make sure it works first.
和往常一样,您希望patch
使用该--dry-run
选项运行以确保它首先工作。
However if the branches don't have the same file layout, then you can't just take a patch and apply it. In this case what you need to do is simply just first commit the other local changes, and then use svn merge
as usual
但是,如果分支没有相同的文件布局,那么您不能只打补丁并应用它。在这种情况下,您需要做的只是首先提交其他本地更改,然后svn merge
照常使用
回答by tobiasbayer
You could create a patch on one working copy (svn diff
) and apply it to the other one (patch
).
http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/
您可以在一个工作副本 ( svn diff
)上创建补丁并将其应用到另一个 ( patch
)。
http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/
回答by Greg
If your changes include deletions, using GNU patch won't cut it. If you want the changes committed to both branches, commit them in one, then svn merge those changes to the other branch. If you did the changes in branch A and need them in branch B instead, svn switch your branch A working copy to branch B.
如果您的更改包括删除,使用 GNU 补丁不会削减它。如果您希望将更改提交到两个分支,请将它们提交到一个分支,然后 svn 将这些更改合并到另一个分支。如果您在分支 A 中进行了更改,而需要在分支 B 中进行更改,则 svn 将分支 A 的工作副本切换到分支 B。