How to remove .svn folder from github repo

I pulled out the repository using TortoiseSVN. It contains the .svn folders in the root and in all subfolders. I created a github repository and clicked the entire repository.

The problem is that in my local copy I deleted the .svn folders from the repo and then made the changes. It does not delete the folder from previous versions of the 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 times (and this is such a waste of time for this) ... so I was wondering if anyone could tell me how to delete all .svn folders from the entire repo in once?

+6
source share
3 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 search is performed recursively for all occurrences of the .svn folder and recursively deletes it and its contents. the --ignore-unmatch prevents git from being held 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 do not mistakenly start tracking these files again.

+6
source

Try the following:

 find . -type d -name .svn | xargs git rm -rf --ignore-unmatch 
+4
source

I recently had to do this on my windows machine. Here is a comparable PowerShell command. there is probably a better way, but I'm pretty awkward with PS:

 gci -Recurse -filter ".svn" | ?{ $_.PSIsContainer } | Select-Object FullName | %{ git rm -rf --ignore-unmatch $_.FullName } 

GCI (Get-Child-Item) will find all things with the name ".svn", PSIsContainer checks if its Select-Object directory should receive only the FullName attribute, and then git rm The -rf command is placed inside the foreach loop.

0
source

Source: https://habr.com/ru/post/894271/


All Articles