git filter-branch
This won't be a terribly fun exercise, and could be very painful if your history contains a lot of merges. (should be easier with the cactus/rebase development model)And of course everyone will have to hard-reset to the new branch.
I should mention I'm far from an expert on this. I've only ever used git filter branch on a handful of commits, and only based on examples provided by kind internet people. I certainly haven't done anything nearly as far-reaching as you're about to embark on.
I'm a bit of a git naif, there are doubtless better ways to do this. This was mine:
0. Back up my repo.
1. Save the entire commit history as patch files.
2. Use BFG (amazing tool) to scrub all references to the unwanted files [0]
3. Create new repo from the commit just before unwanted files.
4. Apply the patches.
5. Use a custom Perl script to apply the dates in the patch files to the new history. [1]
Technically, your repo will be fully reconstructed at step 4. Also, be advised the patch files themselves may have to be massaged to remove references to the file(s) in question. If the filenames themselves are not unwanted, you can add them to .gitignore for good measure.Step 5 merely preserves the dates of the original commits. Keep in mind that for this last step, your script will have to work in reverse chronological order as the history will be altered from that point forward.
[0] https://rtyley.github.io/bfg-repo-cleaner/
[1] http://eddmann.com/posts/changing-the-timestamp-of-a-previous-git-commit/
EDIT: Swap steps 1 and 2. Add advisement that patch files may require manual alteration. Add hint regarding .gitignore. Title case "Perl".The BFG program in this guide [0] seems reasonably close to #2. I don't know if you would need to manually trigger garbage collection in the remote repo, or how you'd do that.
https://help.github.com/articles/removing-sensitive-data-fro...
Which for part 2 then leads to the BFG repo cleaner (which I haven't used)
https://rtyley.github.io/bfg-repo-cleaner/
I've used it in the past, and it's pretty straightforward and does the job well :)
I've browsed through a few git guides, but can't seem to find anything that would let me:
1) Do something like "du -s *|sort -n" for the entire Git history
2) Let me "rm -rf --from-history-too", that would cause the remote repo to actually shrink in size.