[英]How to undo an svn commit that's not at HEAD
I have a commit that's not at head, though later commits didn't touch any files on top of it. 我的提交还没到头,尽管后来的提交并没有触及上面的任何文件。
Is there a way to remove this commit from the trunk? 有没有办法从中继删除此提交?
Thanks, 谢谢,
There's a few basic approaches depending on how important it is that the revision is erased from history: 根据从历史中删除修订的重要性,有几种基本方法:
svn merge
, commit them, and move on svn merge
撤消更改,提交更改并继续 svn obliterate
to be implemented. svn obliterate
。 Don't hold your breath . You can back out a change in Subversion -- even if it's not the head by using svn merge
. 您可以撤消Subversion中的更改-通过使用
svn merge
即使不是最重要的更改。
Let's say you're at revision 100, but realized that a change in Revision 94 has an issue: 假设您的版本为100,但意识到版本94的更改存在问题:
$ svn up # Make sure your working directory is up to date
$ svn st # Make sure there are no pending changes.
$ svn merge -c -94 . # Removes changes done in Revision #94.
Note the negative 94. The -c
means change. 注意负数94。
-c
表示更改。 With a negative revision number, it's the same as if you said: 版本号为负,与您说的相同:
$ svn merge -r 94;93 .
Note that if you're not removing the last change, you may have conflicts (you made a change in Revision #96 that was also changed in Revision #94). 请注意,如果您不删除最后一个更改,则可能会发生冲突(您在版本96中进行了更改,在版本94中也进行了更改)。 It is always recommended to have a clean working directory when you do anything with
svn merge
. 使用
svn merge
进行任何操作时,始终建议您拥有一个干净的工作目录。
You can also use the --dry-run
parameter to see what would be changed before you actually do the reverse merge. 您还可以使用
--dry-run
参数在实际执行反向合并之前查看要更改的内容。 This will help you catch possible conflicts and make sure the files being changed are the ones you think need to be changed. 这将帮助您发现可能的冲突,并确保要更改的文件是您认为需要更改的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.