如何强制 subversion 提交过时的文件?
我想用以前的版本“覆盖”我的最后一次提交。我尝试签出版本 631,进行一些更改,然后将其提交为版本 633。但是 svn 不同意,因为版本 632 存在。
最简单的方法是什么?这是一个多文件提交。我不想手动做。
I would like to "overwrite" my last commit with the previous version. I tried to checkout the version 631, do some changes, and commit it as version 633. But svn doesn't agree, because version 632 exists.
What is the easiest way to do it? It is a multi-file commit. I don't want to make it manually.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不要签出 631,而是对 631 执行
REVERT
。然后您可以更改并签入。Instead of checking out 631, do a
REVERT
to 631. Then you can change and check in.这个问题有点老了,但答案可能对将来的参考有用:
嗯,实际上,不应该将过时的文件提交到 SVN。出于安全原因,服务器本身拒绝这些文件。
要做的一件事是从上一个版本进行更新,但在合并过程中自动保留“过时”文件:
svn up --accept mine-full
换句话说,这将执行更新,但忽略任何传入的合并。
The question is a bit old, but the answer may be useful for future reference:
Well, actually, one is not supposed to commit outdated files to SVN. The server itself refuses those files for security reason.
One thing to do is to make an update from the last version, but keeping your "outdated" files during the merge process automatically:
svn up --accept mine-full
In other words, this will perform the update, but ignore any incoming merge.
如果您无法恢复到版本 631,请执行以下操作:
If you can't do a REVERT to version 631, do the following:
我也想有这个功能。为什么没有类似于 svn commit --force-overwrite-new-version 的命令?
将 SVN 修订版 631 复制到 SVN 修订版 633,然后您可以将更改提交到 SVN 修订版 634。
PS
git
也没有此功能。没有像 git merge foo --force-overwrite 这样的命令。有时需求发生变化,因此提交的一些代码变得无用。这种情况经常发生,因此覆盖代码非常有用。我想知道为什么 svn 和 git 都没有这个功能。多么愚蠢的设计啊!!!
I also want to have this feature. Why isn't there a command similar to
svn commit --force-overwrite-new-version
?Copy SVN revision 631 to SVN revision 633, and then you can commit your changes to SVN revision 634.
P.S. Neither does
git
have this feature. There is no such command asgit merge foo --force-overwrite
.Sometimes the requirement changes, so some code that is committed becomes useless. It happens really often, so overwriting code is vitally useful. I wonder why neither
svn
norgit
has this feature. What a stupid design!!!将包含旧更改的文件复制到其他地方,对文件执行 svn 更新以签入。完成后,用旧文件覆盖新更新的最近文件,然后执行 svn 提交。
Copy the file with the old changes elsewhere, do an svn update of the file to check in. When it is complete overwrite the newly updated recent file with your old file, and then do an svn commit.