如何从 github 存储库中删除 .svn 文件夹
我已经使用 TortoiseSVN 提取了一个存储库。其中根文件夹和所有子文件夹中都有 .svn
文件夹。我创建了一个 github 存储库并推送了整个存储库。
问题是,在我的本地副本中,我已从存储库中删除了 .svn
文件夹,然后提交了更改。它不会从以前版本的存储库中删除该文件夹...
我知道如何从此处删除 github 存储库中的敏感数据:
http://help.github.com/remove-sensitive-data/
但是如果我使用这个,我必须遵循这个过程超过 10 次(而且这太浪费时间了这样做)......所以我想知道任何人都可以告诉我如何一次性删除整个存储库中的所有 .svn
文件夹?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最近需要执行此操作,我只是从存储库的根目录运行以下命令:
这会递归搜索所有出现的 .svn 文件夹,并递归删除它及其内容。
--ignore-unmatch
参数可防止 git 在存储库中找不到指定文件时出现阻塞。当然,接下来要做的是将 .svn 添加到您的 .gitnore 中,这样您就不会再次错误地开始跟踪这些文件。
I needed to do this recently and I just ran the following command from my root directory of my repo:
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.
试试这个:
Try this:
我最近不得不在我的 Windows 机器上执行此操作。这是类似的 PowerShell 命令。可能有更好的方法,但我对 PS 非常笨拙:
GCI(Get-Child-Item)会找到所有名为“.svn”的东西,PSIsContainer 检查它是否是一个目录,Select-Object 应该退出只是 FullName 属性,然后将 git rm -rf 命令放置在 foreach 循环中。
I recently had to do this on my windows machine. Here's the comparable PowerShell command. there's probably a better way, but I'm pretty clumsy with PS:
GCI (Get-Child-Item) will find all the things named ".svn", the PSIsContainer checks if its a directory, Select-Object is supposed to get out just the FullName attribute, and then the git rm -rf command is placed inside a foreach loop.