我们正在使用SVN进行版本控制系统,如何使用svn忽略某些中间修订并接受其他修订?

We are Using SVN for version control System, how to ignore certain middle revisions and accept other revisions using svn?

我们正在使用 SVN 进行版本控制系统,如果我们从版本库修订版“1”开始,A、B、C、D 和 E 提交代码更改(修订版 6 是 E 提交后的最新修订版)。假设程序员 C 的更改必须撤消,但我们想保留 A、B、D、E 的更改。我们如何做到这一点?

希望它能在一定程度上解释。

百万提前致谢 MB钱德

您需要反向合并

如果你使用 TortoiseSVN 客户端,很简单(http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-merge.html):

If you want to merge changes back out of your working copy, to revert a change which has already been committed, select the revisions to revert and make sure the Reverse merge box is checked.

如果使用命令行,会稍微复杂一些(http://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html):

An extremely common use for svn merge is to roll back a change that has already been committed. Suppose you're working away happily on a working copy of /calc/trunk, and you discover that the change made way back in revision 303, which changed integer.c, is completely wrong. It never should have been committed. You can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference. (You can do this by specifying --revision 303:302, or by an equivalent --change -303.)

$ svn merge -c -303 ^/calc/trunk
--- Reverse-merging r303 into 'integer.c':
U    integer.c
--- Recording mergeinfo for reverse merge of r303 into 'integer.c':
 U   A-branch

$ svn status
 M      .
M       integer.c

$ svn diff
…
# verify that the change is removed
…

$ svn commit -m "Undoing change committed in r303."
Sending        integer.c
Transmitting file data .
Committed revision 350.

When we talk about “removing” a change, we're really talking about removing it from the HEAD revision. The original change still exists in the repository's history.