我可以从主干更新分支而不执行合并吗?

发布于 2024-08-23 20:15:49 字数 364 浏览 7 评论 0原文

我可能只是还没有想清楚这一点,或者也许我只是不知道 Subversion 中已经存在的选项(我当然不是专家)。

我只是想知道,如果我创建了一个分支来开始开发某些新功能,是否有一种更简单的方法可以使分支与主干的最新修订保持同步,而无需经历合并一系列修订的所有麻烦。我希望能够简单地更新并从主干(当然还有分支)获取所有修订,而我提交的更改仅影响分支。这可能吗?我问的有道理吗?

我认为这与合并一系列修订版实际上并没有什么不同。只是我使用 AnkhSVN,它在允许合并之前执行所有这些最佳实践检查,有时感觉它比需要的复杂得多。我的想法是,我想让我的分支与其他开发人员可能对主干所做的任何提交保持同步,这样当我最终将我的分支合并到主干时,一切都会顺利(如)顺利(尽可能)。

I probably just haven't thought this through, or perhaps I'm simply unaware of an already existing option in Subversion (I'm certainly no expert).

I'm just wondering, if I've created a branch to start working on some new feature, if there's an easier way to keep the branch up to date with the trunk's most recent revisions without having to go through all the trouble of merging a range of revisions. I would like to be able to simply update and get all revisions from the trunk (and the branch, of course), while my committed changes only affect the branch. Is this possible? Does what I'm asking make sense?

I suppose this isn't really necessarily different from merging a range of revisions; it's just that I use AnkhSVN, which performs all these best-practice checks before allowing a merge, and sometimes it feels like it's a lot more complicated than it needs to be. The idea is that I want to keep my branch up-to-date with any commits other developers may be making to the trunk so that when I eventually do merge my branch into the trunk, everything goes (as) smoothly (as possible).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

倾其所爱 2024-08-30 20:15:49

让您的分支与最新的主干签入保持同步称为合并。

我知道合并有时可能是一场皇家噩梦,但这正是合并的本质。

Keeping your branch up to do date with the latest trunk check-ins is called a merge.

I know merging can be a royal nightmare sometimes, but this is precisely what merging is.

你是年少的欢喜 2024-08-30 20:15:49

TL;博士;不,你必须合并,这里有一些说明

它并不像你想象的那么糟糕。我将概述我使用的命令行的步骤。我将使用 vimidiff 来管理冲突,您可以使用 Meld 或您喜欢的其他差异工具。命令前面有井号“#”标记“

<in branch first time from copy>
# svn log --stop-on-copy | tail 
<read the revision that was the copy instruction in this case r229>
# cd ../../trunk
# svn up
<I make note of the latest rivision which is r334>
<now I go back to the branch>
# cd ../branches/branch 
# svn merge -r229:334 svn://url.to.svn.server/project/trunk
<a whole bunch of stuff happens>
< now I check for conflicts >
# svn status | grep ^C
<which outputs something like>
C       public/tools/Diagnostic.class.php
C       public/domain/Report_Setup_Parameter.class.php
C       public/modules/mReports.module.php
<I now revert all these and manually merge them>
# svn revert public/tools/Diagnostic.class.php
...
<revert done now manuall doinng the merge
# vimdiff public/tools/Diagnostic.class.php ../../trunk/public/tools/Diagnostic.class.php
...
<now all the changes are done>
# svn commit -m "Merging trunk into branch 'branch' r:229:334"
commited revision 335

完成”,如果您定期执行,则不会有太多更改。第一次合并后,您需要使用上次合并的修订版本号。因此,在将来的某个时间,该命令将在 svn 日志中查找,以查找上次合并的修订版本,在本例中为 335。合并命令将如下所示

# svn merge -r335:370 svn://url.to.svn.server/project/trunk

所有其他步骤都相同。

TL;DR; No you must merge, here's some instructions

It's not as bad as you think it is. I will outline the steps from the commandline that I use. I will be using vimidiff to manage the conflicts you can use Meld or someother diff tool that you like. Commands are preceded by the hash '#' mark

<in branch first time from copy>
# svn log --stop-on-copy | tail 
<read the revision that was the copy instruction in this case r229>
# cd ../../trunk
# svn up
<I make note of the latest rivision which is r334>
<now I go back to the branch>
# cd ../branches/branch 
# svn merge -r229:334 svn://url.to.svn.server/project/trunk
<a whole bunch of stuff happens>
< now I check for conflicts >
# svn status | grep ^C
<which outputs something like>
C       public/tools/Diagnostic.class.php
C       public/domain/Report_Setup_Parameter.class.php
C       public/modules/mReports.module.php
<I now revert all these and manually merge them>
# svn revert public/tools/Diagnostic.class.php
...
<revert done now manuall doinng the merge
# vimdiff public/tools/Diagnostic.class.php ../../trunk/public/tools/Diagnostic.class.php
...
<now all the changes are done>
# svn commit -m "Merging trunk into branch 'branch' r:229:334"
commited revision 335

Done, if you do it reguarly then there are not many changes. After the first merge you need to use the revision # of the last merge. Therefore some time in the future the command would look in the svn log to find when the revision of the last merge was, in this case 335. The merge command would look like thuse

# svn merge -r335:370 svn://url.to.svn.server/project/trunk

All other steps are the same.

好听的两个字的网名 2024-08-30 20:15:49

这个想法是我想保留我的
分支与任何提交都是最新的
其他开发商可能正在做出
后备箱,这样当我最终这样做时
将我的分支合并到主干中,
一切进展顺利(如
可能)。

为了实现这一点,您需要从主干进行范围修订合并。实际上,时不时地对分支进行这种合并以了解主干中发生的情况是一个很好的做法。

我不知道 AnkhSVN 的工具,但“纯”SVN 有非常好的工具,可以使合并操作变得非常简单。 TortoiseSVN 是一个很棒的 Windows 工具,如果您喜欢 Netbeans 对合并也有非常好的图形支持。

The idea is that I want to keep my
branch up-to-date with any commits
other developers may be making to the
trunk so that when I eventually do
merge my branch into the trunk,
everything goes (as) smoothly (as
possible).

To achieve that you need to do range-revision merges from trunk. Actually, it is a good practice to do this kind of merge to a branch from time to time to be up-to-date with what is going on in the trunk.

I don't know about the tools for AnkhSVN, but 'pure' SVN has very good tools that make merge operations quite simple. TortoiseSVN is a great tool for Windows and if you like Netbeans there is a very nice graphical support for merge too.

最后的乘客 2024-08-30 20:15:49

我不熟悉 AnkhSVN,但您所描述的正是 svn merge 的用途。所以你的问题的答案是否定的。

但是,您可以查看 --reintegrate 选项,看看这是否会让您的生活更轻松。

请参阅以下博客文章:

Subversion 合并重新集成
Subversion 1.5 合并跟踪简介

I'm not familiar with AnkhSVN, but what you're describing is exactly what svn merge is for. So the answer to your question is no.

However, you might check out the --reintegrate option to see if that makes your life easier.

See these blog posts:

Subversion merge reintegrate
Subversion 1.5 merge-tracking in a nutshell

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文