I have git repo with 50k files. I want to make a new version of this repo that
- Has only 5k files
- Keeps only the commit history of those 5k files.
- For one user (me), squashes their commits to as few as possible
For 1 and 2 I believe there are already answers on S.O. For example this one
For 3, I can't imagine any trivial way to do it. It seems like I'd want to squash every commit by me until some commit by someone else touches a file I touched since my last commit. Is there a command combination to do that or would I have to write some script to figure it out?
In other words. There are files A, B, C,
- commit 1: I edit A
- commit 2: I edit B
- commit 3: Other user edits C
- commit 4: I edit A
- commit 5: I edit C
- commit 6: Other user edits C
At this point 1, 2, 4, 5 can be squished so the new history would be
- commit 1: Other user edits C
- commit 2: I edit A, B, A, C
- commit 3: Other user edits C