Git - 删除一个Blob [英] Git - Delete a Blob

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

问题描述

是否有方法或命令使用其ID删除gb中的blob

Is there a way or command to delete a blob from git using its ID

我使用了命令

$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | grep '^[^ ]* blob' | cut -d" " -f1,3-

获得所有版本的blob列表,如

And got the list of blobs in all versions like

62f7e0df0b80bce8d0a4cb388be8988df1bec5ef NodeApplication/NodeApplication/public/javascripts/homescript.js
b1d69387fbd4d4e84bbe9eb2c7f59053c0355e11 NodeApplication/NodeApplication/iisnode/index.html
624642d6f2a86844dc145803260537be0fe40090 NodeApplication/NodeApplication/.ntvs_analysis.dat

现在我想删除blob p>

Now I want to delete the blob

NodeApplication/NodeApplication/.ntvs_analysis.dat. 

我该如何做?

How can I do that?

推荐答案

我使用bfg清理器清理不需要的大文件,然后执行

I used bfg cleaner to clean the unwanted big files and then did

rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now

这篇关于Git - 删除一个Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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