Undo svn add without reverting local edits

前端 未结 4 1847
慢半拍i
慢半拍i 2020-12-22 20:43

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 ther

相关标签:
4条回答
  • 2020-12-22 21:07

    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
    
    0 讨论(0)
  • 2020-12-22 21:13

    You can fix your checkout in the following way:

    1. Backup your local files
    2. Revert the SVN checkout
    3. Restore the files

    -

    rsync -av --exclude .svn/ YOURDIR/ YOURDIR.bak
    svn revert -R YOURDIR
    rsync -av YOURDIR.bak/ YOURDIR 
    
    0 讨论(0)
  • 2020-12-22 21:16

    I had same problem, i accidentally add a /directory via svn add that contains the binaries and compiled file. This command actually deletes the directory.

    svn rm --force <directory-name>

    In my case i don't need the directory so it was safe to delete. If you want to keep the files/directories save then to a place before applying the command and after copy them back

    0 讨论(0)
  • 2020-12-22 21:24

    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.

    0 讨论(0)
提交回复
热议问题