如何从git仓库中删除一个blob [英] How to delete a blob from git repo

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

问题描述

我无意中将一个数据库转储(超过1 GB)添加到我的回购库中,推送它并在几天后注意到。我使用git filter-branch删除文件,过期reflog并运行git gc来修剪未使用的对象,但数据库转储blob仍处于回购状态。我使用了哪个提交有这个blob?,但确实找到了任何提及blob的提交。如何删除这个或如何找出它在git gc期间未被删除的原因?

I accidentally added a db dump (over 1 GB) to my repo, pushed it and noticed this few days later. I used git filter-branch to delete the file, expired reflog and run git gc to prune unused objects, but the database dump blob is still in repo. I used Which commit has this blob?, but did find any commit which has a reference to the blob. How can I delete this or how to find out why it didn't get deleted during git gc?

推荐答案

在运行git gc的时候调用它?

Which command did you call exactly when running git gc?

请注意git gc的联机帮助页:

Note the manpage of git gc:


可选的配置变量gc.pruneExpire控制未修剪的松散对象在修剪之前必须先处理多长时间。默认是2周前

The optional configuration variable gc.pruneExpire controls how old the unreferenced loose objects have to be before they are pruned. The default is "2 weeks ago"

所以如果你的blob比14天小,你必须打电话给

So if your blob is younger than 14 days, you have to call

git gc --prune=<date> (for date you also can insert now)

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

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