removing a file/directory permanently from git

29 Jun 2010 \\ git 

I'm not entirely sure how many times I've needed this or how many times I've dug it up only to forget it later, but here is how to permanently remove a file or directory from a git repository. This comes by way of Dalibor Nasevic's site.

# blackhole the content
git filter-branch --tree-filter 'rm -rf my/folder' HEAD

# force the update
git push origin master --force

If you like to read up on these things, you can find more information in Chapter 6 of the ProGit book.

navigation:

interesting projects: