Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force subversion to commit an outdated file?

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.

like image 963
Bartlomiej Grzeskowiak Avatar asked Jul 26 '11 16:07

Bartlomiej Grzeskowiak


4 Answers

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.

like image 171
rafaelrezend Avatar answered Nov 12 '22 23:11

rafaelrezend


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.
like image 36
Gilbert Le Blanc Avatar answered Nov 13 '22 00:11

Gilbert Le Blanc


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!!!

like image 36
Victor Avatar answered Nov 12 '22 23:11

Victor


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

like image 33
Raj More Avatar answered Nov 13 '22 00:11

Raj More