I have a git repo that I need to get working without conflicts. It is .net/c# mvc repo. The problem is dll and pdb files. These files have been accidentally committed to the repo so when I do my initial git pull
, I get all these files committed by another developer.
I have setup the .gitignore
like so:
bin/
obj/
App_data/
From other posts I believe that is all I should need to do, however, If I build my project and run git status
it shows numerous dll and pdb files that are going to be committed.
Is this because those files existed in the repo when I cloned it? If so, what is the best way to go about removing those files?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With