简体   繁体   中英

SVN merge previous revision into working copy

If

  • I'm working on an SVN branch at revision 5.
  • I make a change, commit to create revisions r6.
  • Revert back to r5 as r6 introduced problems, and commit, creating r7
  • Continue working on r7, eventually committing changes up to r10

How do I merge the changes made in r6 back into my working copy?

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 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.

This may introduce properties into your repository (svn:mergeinfo, if memory serves), at least if you perform the merge on a whole directory. 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. 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).
  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 .

You could revert. Create a tag. Once you are done, you can merge changes from the tag to the branch you are working in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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