To remove a folder named build from git I use:
git rm --cached -r build
As I learned from this answer.
However, IIUC, the directory remains in the git's database.
I tested the matter:
- Initialised a new git repository.
- Added a new directory, named build, with a large file (7MB) and committed.
performed:
git rm --cached -r build
The size of the .git directory remained 7mb which means the untracking and deletion did not change the git history, presumptuously as it should.
What is the way to completely clean up a wrongly committed directory which was committed a few commits back?
In my case as I was only on my third commit with little concern to the history of the project, I deleted the .git folder and started over but I am wondering whether there is a better way.