A Docker Image with git-filter-repo integrated
# Using build.sh script
$ ./build.sh
# or manually
$ docker build -t qnimbus/docker-git-filter-repo .
git-filter-repo_func() {
docker run --rm -v "${PWD}:${PWD}" --user "$(id -u):$(id -g)" --workdir="${PWD}" qnimbus/docker-git-filter-repo git filter-repo "$@"
}
alias git-filter-repo="git-filter-repo_func"
$ git config --global alias.deleted "log --diff-filter=D --summary"
# Usage:
$ git deleted
$ git ls-tree --full-tree -r HEAD | more
$ git clone --mirror <your repo> mirror_repo
$ docker run --rm -it -v ./mirror_repo:/repo qnimbus/docker-git-filter-repo --workdir=/repo /bin/bash
# Example which removes two paths
$ git filter-repo --invert-paths --path unneeded_path1 --path unneeded_path2
# Or a path-glob for multiple files
$ git filter-repo --invert-paths --path-glob '*.json'
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
$ git push --no-verify --mirror