Permanently remove files from git repo
If you accidentally pushed some files to the git repos and you want to permanently delete them (so that you can reduce the repo size) you can use this command:
git filter-branch --tree-filter 'rm -rf my_folder/my_file' HEAD
Written by Emanuele
Related protips
1 Response
It's worth noting that it rewrites your entire history (from when the file was created), so it doesn't work well with a shared repo unless you can force everybody to throw away their local copy and clone a fresh copy.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#