开发者

Reverting in subversion

开发者 https://www.devze.com 2023-03-27 02:37 出处:网络
Say I want to revert some changes between version n and (n-1) in Subversion. I would just put back the files from version (n-1) - take them from the repository and check back in as the latest version

Say I want to revert some changes between version n and (n-1) in Subversion.

I would just put back the files from version (n-1) - take them from the repository and check back in as the latest version in the trunk.

Here it seems they want to make a branch from version (n-1) and merge it back with the trunk.

开发者_Python百科How is this better or "more correct"?

In this case it is a few files within one directory. These files do not have other recent changes.


To cleanly remove a bad commit for you and for others...

the "revert" is not the one you are looking for, because it only affects local changes. in order to revert a already submitted revision you have to use "svn merge" using the negate syntax by putting a "-" (minu) in front of the revision you wish to remove.example:

current rev: 1337

bad rev: 1330

$sh> svn merge -c -1330 svn://your.svn.url:/your.svn.path .
$sh> svn ci -m "removed revision 1330"

so you do reverse-merge your repository with rev "-1330" and do a checkin afterwards thus removing the changes from 1330 for you and the other developers.

Will


To remove changes between specific revisions, say 1000 and 1010 in the past:

From a checked out, up to data working copy type:

svn merge -r 1010:1000 .

This removes all the changes in your working copy between revisions 1000 and 1010 (not including changes added to 1000 itself). It's safe to play around with this as long as you don't have any local modifications and don't check the results back in until you've verified that it did what you wanted.

In your particular case since you only want to remove a single revision you can use '-c' instead of the more general -r:

svn merge -c 2000 .

This is equivalent to -r 1999:2000 removing the changes between 1999 and 2000.


Use svn merge, it's very useful for your scenario.

svn merge -c n http://xxxx/xxx/xx
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号