SVN reverse merge?

2019-01-12 23:03发布

My SVN repository was perfect at revision 497. I performed several bad commits, so that now it is at revision HEAD. I see that to rollback you should use a command like this:

svn merge -r HEAD:497 .

while in the working directory (and the working directory is at the HEAD revision). But is that the right command? Or do I use HEAD:498? or 496? I already ran that command and the current revision doesn't appear to be the same as 497, because when I update -r 497 (or when I have a 497 working copy and I update -r HEAD), a lot of file updates occur.

Do I have some sort of fencepost problem, where HEAD:497 actually reverts to 496, or something? Or is it that when I update, SVN goes back through each revision, despite the fact that the HEAD and 497 are identical?

Edit:

Just to clarify, as I said earlier when I update between 497 and my merged HEAD, I see a lot of file changes take place. I thought that if 497 and HEAD were identical, it would detect that, and no file changes would occur; it would simply say "Updated to revision 497." So is my command wrong, or is this thinking wrong? (and if so, why?)

标签: svn
8条回答
萌系小妹纸
2楼-- · 2019-01-12 23:41

If you want a quick and reliable way to rollback to a particular revision, then just check out the older revision of the repository.

Run svn info to remind yourself what your repository URL is, then create a new folder and checkout the revision you want:

cd <your new folder>
svn checkout <URL> -r 497 .

Then you can diff that folder against your existing folder, and you can commit that entire revision back into the repository from there if you need to.

查看更多
放我归山
3楼-- · 2019-01-12 23:43

If you want to undo r123, you need to svn merge -r 123:122 .

This means you need to run

svn merge -r HEAD:497 .

To verify run:

svn diff -r 497
查看更多
Explosion°爆炸
5楼-- · 2019-01-12 23:45

For anyone using TortiseSVN, you can just bring up the "Show Log" dialog revert commits from there:

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-howto-rollback.html

查看更多
时光不老,我们不散
6楼-- · 2019-01-12 23:46

Consider HEAD:150 revert r1=100 and r2 =90

  1. svn up
  2. svn merge -r 100:99
  3. svn merge -r 90:89

Note: These changes will not revert EXTERNALS folder!

查看更多
登录 后发表回答