Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - Delete a Blob

Tags:

git

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

I used the command

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

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

Now I want to delete the blob

NodeApplication/NodeApplication/.ntvs_analysis.dat. 

How can I do that?

like image 314
keerthee Avatar asked Aug 06 '15 12:08

keerthee


1 Answers

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

git reflog expire --expire=now --all
git gc --aggressive --prune=now
like image 148
keerthee Avatar answered Sep 28 '22 07:09

keerthee