从git中永久删除一个目录 [英] Remove a directory permanently from git

查看:104
本文介绍了从git中永久删除一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我个人的git repo中,我有一个包含数千个不再需要的小图片的目录。有没有办法从整个git历史中删除它们?我试过了

  git filter-branch --index-filtergit rm -rf --cached --ignore-unmatch imgs HEAD 

  git filter-branch --tree-filter'rm -fr imgs'HEAD 

但git回购的大小保持不变。任何想法?



谢谢

解决方案

我。
我发现最可靠的就是简单地将本地拉到另一个回购:

  git pull file:// $ (pwd)/ myGitRepo 

它还可以节省您删除旧标签的麻烦。

查看我博客上的故事:
http://stubbisms.wordpress.com/2009/07/10/git-script-to- show-largest-pack-objects-and-trim-your-waist-line /


In my personal git repo, I have a directory that contains thousands of small images that are no longer needed. Is there a way to delete them from the entire git history? I have tried

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch imgs" HEAD

and

git filter-branch --tree-filter 'rm -fr imgs' HEAD

but the size of the git repo remains unchanged. Any ideas?

Thanks

解决方案

Actually none of these techniques workedfor me. I found the most reliable was was to simply pull locally into another repo:

git pull file://$(pwd)/myGitRepo

It also saves you the hassle of deletig old tags.

see the story on my blog: http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/

这篇关于从git中永久删除一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆