git: can't find blob - want to get rid of it from pack

前端 未结 5 457
广开言路
广开言路 2021-01-02 01:32

I\'ve a large blob that I want to get rid of! I thought I removed the file using this solution: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/ (I

5条回答
  •  暖寄归人
    2021-01-02 01:36

    Having the same issue. Discovered my troublesome blob is referenced by an unreachable tree. Adding to the git-find-blob script:

    git fsck --full --unreachable | \
    while read unreachable obj tree
    do
        if [[ ! $obj == "tree" ]]; then
            continue
        fi
        if git ls-tree -r $tree | grep -q "$obj_name" ; then
            echo "$unreachable $obj $tree"
        fi
    done
    

    I was able to remove the blob using BFG Repo-Cleaner but I'd be much happier solving the problem using native git commands.

提交回复
热议问题