简体   繁体   English

SVN:将本地更改合并到其他工作副本中

[英]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.

相关问题 带有SVN的网站:工作副本:配置Apache httpd.conf进行本地svn签出-如何? - Website w/SVN: Working Copy: Configuring Apache httpd.conf for local svn checkout - HOWTO? SVN,无法使用Tortoise为Ubuntu 12.04计算机上的工作副本提交更改 - SVN, can't commit changes using Tortoise for a working copy that resides on Ubuntu 12.04 machine 无法升级SVN工作副本 - Unable to upgrade SVN working copy 使用“ svn merge”合并时复制SVN日志消息 - Copy SVN log messages when merging using 'svn merge' 从SVN中现有工作副本的一部分制作工作副本 - Make a working copy from part of an existing working copy in SVN 自动从SVN导出工作副本 - Automatically export a working copy from SVN 在工作副本修订版上将链接复制/粘贴到SVN上的文件 - Copy/paste link to file on SVN at working copy revision 如何确定SVN工作副本是否需要更新(从脚本)? - Howto determine if an SVN working copy needs updating (from a script)? 当工作副本位于网络驱动器上时,SVN提交后将更新工作副本 - SVN Post-Commit to Update Working Copy when Working Copy is on a Network Drive 命令行SVN帮助检查工作副本是否是服务器中存在的副本的过期副本 - Command line SVN help to check the working copy is an outdated copy of the one present in the server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM