Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo svn add without reverting local edits

Tags:

svn

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.

like image 771
jonderry Avatar asked Feb 22 '11 20:02

jonderry


People also ask

How remove svn added files?

$ 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.

How do I get reverted changes back in svn?

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.

What does Revert command do in svn?

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.


2 Answers

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.

like image 105
Nostradamus1935 Avatar answered Nov 09 '22 23:11

Nostradamus1935


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 
like image 41
Juampy NR Avatar answered Nov 09 '22 22:11

Juampy NR