简体   繁体   English

SVN将以前的修订版合并到工作副本中

[英]SVN merge previous revision into working copy

If 如果

  • I'm working on an SVN branch at revision 5. 我正在修订版5的SVN分支机构。
  • I make a change, commit to create revisions r6. 我做了一个更改,承诺创建修订版r6。
  • Revert back to r5 as r6 introduced problems, and commit, creating r7 当r6引入问题时,恢复为r5,并提交,创建r7
  • Continue working on r7, eventually committing changes up to r10 继续在r7上工作,最终将更改提交到r10

How do I merge the changes made in r6 back into my working copy? 如何将r6中所做的更改合并到我的工作副本中?

I've tried 我试过了

svn merge -r5:6 .

and

svn merge -r5:HEAD .

Both of which seem to do nothing. 两者似乎都无能为力。 What am I doing wrong? 我究竟做错了什么?

Try this: 试试这个:

svn merge --ignore-ancestry -r5:6 .

or using newer syntax: 或使用更新的语法:

svn merge --ignore-ancestry -c6 .

btw: I recommend to always specify what files you want to work with instead of "." 顺便说一句:我建议您始终指定要使用的文件而不是“。”

If you are using a relatively recent svn release, you can use: 如果您使用的是相对较新的svn版本,则可以使用:

svn merge -c -6 .


(or the specific file(s) you would like to revert, rather than '.') (或您想要还原的特定文件,而不是'。')
This is a shorthand for: 这是一个简写:

svn merge -r6:5 .

so if your on an older subversion release (prior to 1.6.x) you can use this syntax. 因此,如果您使用较旧的subversion版本(1.6.x之前),则可以使用此语法。

This may introduce properties into your repository (svn:mergeinfo, if memory serves), at least if you perform the merge on a whole directory. 这可能会将属性引入您的存储库(svn:mergeinfo,如果内存服务),至少如果您在整个目录上执行合并。 reverting a change to a single file, or set of files, does not affect properties. 将更改还原为单个文件或文件集不会影响属性。 If you don't want these properties added to your repository, you may need to fall back to a patch (automated or manual). 如果您不希望将这些属性添加到存储库中,则可能需要回退到补丁(自动或手动)。

I am not too familiar with command line svn. 我对命令行svn不太熟悉。 But in case the correct usage does not get you the result you want here is what I would try: 但是如果正确的用法没有得到你想要的结果我会尝试:

  1. Create a patch out of revision r6 (differences between r6 and r5). 从版本r6创建补丁(r6和r5之间的差异)。
  2. Apply it on the working copy. 将其应用于工作副本。

Try reversing the revision that merged out the initial revert. 尝试撤消合并出初始还原的修订版。

eg Instead of svn merge -r 5:6 try svn merge -r 7:6 . 例如,而不是svn merge -r 5:6尝试svn merge -r 7:6。

You could revert. 你可以回复。 Create a tag. 创建一个标签。 Once you are done, you can merge changes from the tag to the branch you are working in. 完成后,您可以将标记中的更改合并到您正在使用的分支中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM