Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely remove .svn files in Git

Tags:

git

dvcs

svn

I am trying to remove all .svn files and folders for my repo. I am using Git. But I downloaded the source from a server which came with all the nasty .svn files. I don't want to committ these. I have already created a .gitignore file to completely ignore .svn files but this isn't working.

I have already searched and read loads of answers on the web and on Stack Overflow. I tried using

find . -type d -name '.svn' -exec git rm -rf {} \;

To completely remove .svn files but they still linger. I am using Source Tree and tried Git Tower, but all the .svn files still appear as pending.

It maybe that I have previously accidentally committed a .svn file so its still appearing. Any clues how to ignore them totall or remove them would be a god send.

like image 575
Steven Wu Avatar asked Apr 12 '12 20:04

Steven Wu


People also ask

How do I delete a .svn file?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…

Can we delete .svn folder?

There is only one . svn folder, located in the base of the working copy. If you are using 1.7, then just deleting the . svn folder and its contents is an easy solution (regardless of using TortoiseSVN or command line tools).

How do I delete a .svn folder recursively?

The find command returns a list of all the subfolders matching “. svn”, and this is then piped to the rm command to recursively delete the directory. Running rm using the full path will remove the confirmation prompt, and the “rf” arguments will recursively delete any folder contents.

How do I delete a .svn file in Windows?

Right click on the project, go to Team->disconnect. It will open a popup where you select the first option: 'Also delete the SVN meta-information from file system. ' This will remove all the SVN folders automatically along with svn property files that you might forget sometimes while removing .


1 Answers

find . -name '.svn' -type d -print0 | xargs -0 rm -rf
git commit -a -m "Deleting all .svn folders and files"

You can also update the .gitignore file afterwards.

like image 141
sjakubowski Avatar answered Sep 21 '22 00:09

sjakubowski