Skip to content

Instantly share code, notes, and snippets.

@agarny
agarny / git-remove-files-from-history
Created May 8, 2013 15:05
A simple shell script (based on information found at https://help.github.com/articles/remove-sensitive-data) to remove files based on their extension. The idea was for me to permanently remove some binary files I had in a git repository history.
#!/bin/sh
function updateFiles()
{
export files=`git rev-list --all --objects | awk '{ print $2; }' | sort | uniq | grep -e "\.dll$" -e "\.dll\.a$" -e "\.dylib$" -e "\.lib$" -e "\.pdf$" -e "\.pptx$" -e "\.so$" -e "\.so\..$" -e "\.zip$" | sort | uniq`
}
updateFiles
needCleaningUp=0