====== Git: remove sensitive data ====== Link: [[https://help.github.com/articles/remove-sensitive-data]] - show all files (current & historical)\\ git log --all --pretty=format: --name-only | sort -u | uniq - completely remove file from git (including history)\\ git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch ' --prune-empty --tag-name-filter cat -- --all - remove backups\\ rm -rf .git/refs/original/maybe replaced bygit for-each-ref --format="%(refname)" .git/refs/original/ | xargs -n 1 git update-ref -d - delete unreachable commits\\ git reflog expire --expire=now --all - start garbage collection\\ git gc --prune=nowgit gc --aggressive --prune=now - push changes\\ git push origin master --force If this step fails, you've to set //denyNonFastforwards = false//.