Skip to content

Instantly share code, notes, and snippets.

@nickcheng
Created November 29, 2017 05:42
Show Gist options
  • Save nickcheng/93668b4042c07d4a46f5ad1648f070d6 to your computer and use it in GitHub Desktop.
Save nickcheng/93668b4042c07d4a46f5ad1648f070d6 to your computer and use it in GitHub Desktop.
Remove big file in GIT repo
# List the biggest object
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -10 | awk '{print$1}')"
# Remove file from git repo
# Replace "filepath" to the file's full path
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch filepath' --prune-empty --tag-name-filter cat -- --all
# After doing so, remember to push it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment