WARNING: git-filter-branch has a glut of gotchas generating mangled history rewrites

by ajcg   Last Updated May 23, 2020 00:00 AM - source

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

#!/bin/bash
project="myprojectgit"
bigfile="superbigfile.tar.gz"

cd $project

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
git clean -nd
git clean -fd
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now --aggressive

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,
     set FILTER_BRANCH_SQUELCH_WARNING=1.

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

Tags : bash git


Related Questions


BASH: bash completion function in a custom script

Updated April 15, 2015 23:00 PM

Run local script over ssh

Updated May 05, 2015 00:00 AM