In Git, removing DLL and PDB files that have accidently been committed

You need to remove those file first (git rm), before seeing your .gitignore directoves applied to your git repo.

You can remove those files only from the index if you want to keep them on the working tree.

git rm -r --cached a.dll

(See ".gitignore file not ignoring")

But for generated files, it shouldn't matter if they are removed: you will re-create them at the next compilation, but ignore them because they aren't part of the index anymore.


This is very common question and the usual answer is that you cannot clean up past commits, but there are special tools for this . git filter and easier the BFG repo cleaner: http://rtyley.github.io/bfg-repo-cleaner/#usage

Tags:

.Net

Git