开发者

How can I force subversion to commit an outdated file?

开发者 https://www.devze.com 2023-03-22 20:47 出处:网络
I would like to \"overwrite\" my last commit with the previous version. I tried to checkout the version 6开发者_Go百科31, do some changes, and commit it as version 633. But svn doesn\'t agree, because

I would like to "overwrite" my last commit with the previous version. I tried to checkout the version 6开发者_Go百科31, 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.


Instead of checking out 631, do a REVERT to 631. Then you can change and check in.


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.


If you can't do a REVERT to version 631, do the following:

  • Save your changes someplace outside your work area.
  • Update your work area to version 632 (HEAD).
  • Reapply the changes to your work area.
  • Commit.


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.

svn copy remote_url@631 remote_url
svn commit

P.S. Neither does git have this feature. There is no such command as git 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 nor git has this feature. What a stupid design!!!


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.

0

精彩评论

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

关注公众号