Skip to content

Instantly share code, notes, and snippets.

@dannyduc
Created October 6, 2012 16:31
Show Gist options
  • Save dannyduc/3845387 to your computer and use it in GitHub Desktop.
Save dannyduc/3845387 to your computer and use it in GitHub Desktop.
Remove files from git history
Rewrite history
git filter-branch -f --index-filter 'git rm -rf --cached --ignore-unmatch target/* .idea/*' --prune-empty -- --all
Cleanup and reclaim space
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now
Push to remote repository
git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment