I want to clean a large file from my local git repository (and incidentally clean my repository to reduce size). This is my bash:

git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch '"$bigfile"'' --prune-empty --tag-name-filter cat -- --all
git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch '"$bigfile"'' HEAD

But now show the following warning:

WARNING: git-filter-branch has a glut of gotchas generating mangled history
     rewrites.  Hit Ctrl-C before proceeding to abort, then use an
     alternative filtering tool such as 'git filter-repo'
     (https://github.com/newren/git-filter-repo/) instead.  See the
     filter-branch manual page for more details; to squelch this warning,

I have always used this bash and have never had a problem. Until now. I guess something changed in git.

I try to replace "git filter-branch" with "git filter-repo" but I get the message:

git: 'filter-repo' is not a git command. Look at 'git --help'.but

what should i fix? thanks


I did this but it seems that everything changed

wget https://raw.githubusercontent.com/newren/git-filter-repo/master/git-filter-repo -O /home/user/.local/bin/git-filter-repo
chmod +x /home/user/.local/bin/git-filter-repo

And replace in my script "git filter-branch" with "git filter-repo". Out:

git-filter-repo: error: argument --prune-empty: expected one argument
git-filter-repo: error: unrecognized arguments: --index-filter git rm -r --cached --ignore-unmatch bigfile.tar.gz HEAD

I checked the examples and I add "--prune-empty auto", but i couldn't fix my script, because I don't know what the alternatives to "--index-filter" or "--tag-name-filter" will be (it seems they don't exist)

git filter-repo --version
git --version
git version 2.25.1


I have managed to reduce the size of my repo with the command:

git filter-repo --strip-blobs-bigger-than 10M

But it is an unsuitable method, since i can delete other files that are larger than 10M and that I do not want to be deleted


git filter-repo --path bigfile.tar.gz --invert-paths

vote close

  • Just tried your solution but got this message fromm git: 'filter-repo' is not a git command. See 'git --help'.
    – Ali Safari
    Aug 5, 2020 at 10:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.