使用 (Ankh) SVN 使跨分支的两个文件相同
不幸的是,我并不完全清楚 SVN 是如何工作的...
我有一个主干用于我的主要 Visual Studio C# 解决方案,还有一个分支用于开发工作。 有时,两者都需要进行一些更改,以便代码相同。我已经查看了合并向导,但它似乎没有描述这个问题。它似乎允许我合并特定的修订号,其中可能包含对其他文件的更改,而不是考虑每个文件的合并。
我该怎么做?
Unfortunately, I'm not entirely clear on how SVN works...
I have a trunk for my main Visual Studio C# solution, and a branch, for work in development. Now and again, something needs to be changed in both, so that the code is identical. I've had a look at the Merge wizard, but it doesn't seem to describe this issue. It seems to allow me to merge specific revision numbers, which may contain changes to other files, rather than considering the merge on a per-file basis.
How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以对文件运行“合并”命令。您需要确保“合并自”值指向正确分支中的文件(即具有您想要获取的更改的文件)。您会注意到合并向导将列出该文件的所有修订版本。您现在可以安全地选择修订版(可能包含对其他文件的更改),因为只有对文件的更改才会合并到您的工作副本中。
请记住在合并后构建/测试您的工作副本,然后将更改提交回存储库。
您还可以利用“合并通过选择“所有符合条件的修订”选项来跟踪”功能(在 SVN 1.5+ 中提供)。
我建议将 AnkhSVN 配置为使用外部合并工具(通过 Visual Studio 中的“工具 > 选项 > 源代码控制 > Subversion 用户工具”)。
It is possible to run "Merge" command on the file. You need to make sure that "Merge From" value points to the file in the right branch (i.e. to the file that has the changes you want to get). You will notice that the merge wizard will list all the revisions for that file. You can now select revision(s) (which may contain changes to other files) safely since only the changes to your file will be merged into your working copy.
Remember to build/test your working copy after the merge, and then to commit the changes back to repository.
You can also take advantage of the "Merge Tracking" feature (available in SVN 1.5+) by selecting the "all eligible revisions" option.
I recommend to configure AnkhSVN to use an external merge tool (via Tools > Options > Source Control > Subversion User Tools in Visual Studio).
最好的方法是在主干中进行更改,然后从主干合并到您的开发分支。
一个更复杂的版本(在编写此代码时保持主干安全)是从主干创建另一个分支来表示常见的“更改”(服务包分支)。进行更改并在服务包分支中测试它们,然后合并回主干。然后从主干向下合并到您的开发分支。
The best way to do this is to make the change in trunk, and merge from trunk to your dev branch.
A more complicated version (that keeps your trunk safe while writing this code) is to create another branch from trunk to represent the common "changes" (a service pack branch). Make the changes and test them in the service pack branch, then merge back up to trunk. Then merge down from trunk into your dev branch.