Skip to content

Instantly share code, notes, and snippets.

@scollett
Last active December 19, 2015 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scollett/5889283 to your computer and use it in GitHub Desktop.
Save scollett/5889283 to your computer and use it in GitHub Desktop.
I had to permanently remove a ginormous folder of seed data from the git repository history (moved it outside the project). I combined advice in several posts on removing folders/files till it worked. I'm not sure if you need all those parameters to both the tree and index filter, but it worked. *Note, be careful if you've already pushed to a sh…
git filter-branch --prune-empty --tree-filter 'git rm -rf --cached --ignore-unmatch FOLDER_OR_FILES_TO_REMOVE' --tag-name-filter cat -- --all
git filter-branch --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch FOLDER_OR_FILES_TO_REMOVE' --tag-name-filter cat -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment