I use git for various projects (personal repositories only), and I want to do some housekeeping.
I have a downloaded git project tree that has a large history of commits. After downloading I made a few more myself. However, I do not need anything apart from the latest commit at the time I downloaded it, and the subsequent commits that I made. All the prior commits take up a lot of space, and I'd like to get rid of them.
What I should have done is delete the .git folder after download and create a new personal repository going forward - but I didn't.
So my question is this: can I clean up the repository so that everything prior to commit X is removed, as if it had never existed, but so that subsequent commits are maintained? If so, how? Also if possible, if there were multiple branches at that time, can I remove other branches also?
(Not sure if this is possible as I think one of git's claims is how hard it is to lose old data by mistake).