Skip to content

Instantly share code, notes, and snippets.

@brianloveswords
Created June 6, 2017 19:57
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianloveswords/29df2fc0f68ce96f42b85eadf8673b70 to your computer and use it in GitHub Desktop.
Save brianloveswords/29df2fc0f68ce96f42b85eadf8673b70 to your computer and use it in GitHub Desktop.
Obliterate a file from your git history
#!/usr/bin/env bash
file="$1"
test -z "$file" && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached '$file' --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment