I stupidly added a directory with many files ( ~450,000 ) to git, and want to delete them — later I plan to rebase/squash various commits to remove the files from the history altogether.
However, ‘git rm’ is VERY slow. For example, in a directory with 10,000 files (on a Mac), git v2.14.2
Git add . : 5.95 secs
Git commit : 1.29 secs
Git rm -r : 22 secs
50,000 files
Git add . : 25 secs
Git commit : 11 secs
Git rm : After 20 minutes, I killed it.
Looking at an optimized profile, all the time seems to be spent in “get_tree_entry” — I assume there is some huge object representing the directory which is being re-expanded for each file?
Is there any way I can speed up removing this directory?
Chris