[英]SVN: merge local changes into other working copy
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?
是否可以将一个项目中的本地更改合并到另一个工作副本?
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. 如果对现有文件进行了更改,最简单的方法是使用
svn diff
创建补丁,然后将该补丁应用于其他工作副本。 Eg. 例如。 in the first working copy you do:
在你做的第一个工作副本中:
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. 和往常一样,您希望使用
--dry-run
选项运行patch
,以确保它首先运行。
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
You could create a patch on one working copy ( svn diff
) and apply it to the other one ( patch
). 您可以在一个工作副本(
svn diff
)上创建一个补丁,并将其应用于另一个( patch
)。 http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/ http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/
If your changes include deletions, using GNU patch won't cut it. 如果您的更改包含删除,则使用GNU补丁不会删除它。 If you want the changes committed to both branches, commit them in one, then svn merge those changes to the other branch.
如果您希望将更改提交到两个分支,请将它们一个提交,然后svn将这些更改合并到另一个分支。 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.
如果您在分支A中进行了更改并在分支B中需要它们,则svn将您的分支A工作副本切换到分支B.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.