Skip to content

Instantly share code, notes, and snippets.

@vraravam
Created February 22, 2016 04:48
Show Gist options
  • Save vraravam/bd1373abeaee41b422ed to your computer and use it in GitHub Desktop.
Save vraravam/bd1373abeaee41b422ed to your computer and use it in GitHub Desktop.
Git commands to remove specific files from history
To find the blobs taking up the max space:
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -100 | awk '{print$1}')"
To delete blobs from history:
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch node_modules/* plugins/* platforms/* resources/ios/* resources/android/*' --tag-name-filter cat -- --all
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch public/assets/*' --tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment