I accidentally ran svn add *
and added a bunch of files that shouldn't be in the repository. I also have local edits in some files that I want to keep. Is there a simple way to just undo the svn add
without reverting the local edits? The main suggestion I see on Google is svn revert
, which supposedly undoes the local edits.
$ svn delete -m "Deleting file 'yourfile'" \ file:///var/svn/repos/test/yourfile Committed revision 15. Use the --keep-local option to override the default svn delete behavior of also removing the target file that was scheduled for versioned deletion.
Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.
Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes.
That would be:
svn rm --keep-local
The same thing happened to me. :-P
Many people have commented that you should use:
svn rm --keep-local FILENAME
to apply the command on one or many files, instead of everything, which may have unintended side-effects.
If those files are under a directory which has not been committed yet, you can remove the whole directory contents from the next commit by doing:
svn delete --keep-local /path/to/directory
However, if those files are already in the repository and now contain changes that you do not want to commit, you can commit the rest of the files using changelists:
svn changelist somename /file/to/be/committed svn commit --changelist somename
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With