Remova (remova) arquivos de todo o seu histórico do Git.

Caso você tenha esquecido de remover arquivos sensíveis ou binários do seu repositório Git, aqui está um script rápido que visa remover todos os referidos arquivos de todos os seus commits anteriores. Você pode executá-lo assim:
sh git-delete-history file1 dir1

Versão da essência aqui .

#!/bin/bash
# Script to permanently remove files/folders from your git history. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete

set -o errexit

if [ $# -eq 0 ]; then
echo
"Usage: $0 file1 file2"
echo
" or: $0 path1 path2"
exit 0
fi

# make sure we're at the root of git repo by checking for a .git dir
if [ ! -d .git ]; then
echo
"Error: must run this script from the root of a git repository"
exit 1
fi

# remove all paths passed as arguments from the history of the repo
files
=$@
git filter
-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD

# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm
-rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune