Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove .svn folder from github repo

I have pulled a repository using TortoiseSVN. In it are .svn folders in the root and all subfolders. I have created a github repository and pushed whole repository.

The problem is that in my local copy I have deleted the .svn folders from repo and then commited the changes. It doesn't remove the folder from previous versions of repository...

I know how to remove sensitive data from github repo from here:

http://help.github.com/remove-sensitive-data/

But if I use this I have to follow this procedure more than 10 time (and it's such a waste of time to do that) ... so I was wondering that anyone can tell me how to delete all .svn folders from the whole repo in a single go?

like image 538
Safran Ali Avatar asked Aug 04 '11 10:08

Safran Ali


People also ask

How do I delete a .SVN folder?

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…

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 remove a Git repository folder?

Browse to the directory in the repository and branch that you want to delete. In the top-right corner, click "…", and then Delete directory.

Can I delete SVN checkout folder?

Just delete your complete local checked-out working copy (including all . svn directories). This will not modify your repository as you are not committing your deletion.


2 Answers

I needed to do this recently and I just ran the following command from my root directory of my repo:

 find . -name '.svn' | xargs git rm -rf --ignore-unmatch

This searches recursively for all occurrences of the .svn folder and removes it and its contents recursively. the --ignore-unmatch parameter prevents git from choking if it does not find the specified file in the repository.

The next thing to do, of course, is to add .svn to your .gitnore so that you don't mistakenly start tracking those files ever again.

like image 181
dkinzer Avatar answered Nov 23 '22 22:11

dkinzer


Try this:

find . -type d -name .svn | xargs git rm -rf --ignore-unmatch
like image 44
Martin Thoma Avatar answered Nov 23 '22 20:11

Martin Thoma