This is a very big local git repo just because its long long history. I would like to remove all the history snapshots before 2021-01-01. How can I achieve that?
Asked
Active
Viewed 39 times
1
-
1Does this answer your question? [Git - Squash All Commits in History Before Specific Commit](https://stackoverflow.com/questions/53587814/git-squash-all-commits-in-history-before-specific-commit) – mkrieger1 Oct 21 '21 at 09:29
-
The real question you should be asking yourself is why is it so big? A "long history" still shouldn't be very big. Git has a pretty efficient file system. I would wager that your storing binary files in your repo? You shouldn't do this as git doesn't work with binary data very well. Only text files should be committed to git. If you do use binary files, you should use LFS (as below) – Liam Oct 21 '21 at 09:38
1 Answers
1
You can't without causing the commit hashes to change and break things. If you're working with multiple branch's, these may also get disconnected. Proceed with extreme caution when you do anything with filter-repo or filder-branch.
To work with really large repositories, you can look at shallow clones, partial clones, sparse checkout or Microsoft's Virtual Filesystem for Git. Microsoft uses its virtual filesystem driver to with with the Windows and Office git repos which are each multiple 100s of GB in size.
To prevent a repo from growing too large, you could also look at Git-LFS to externalize large files, but converting an existing repo will also cause all commit hashes to change.

jessehouwing
- 106,458
- 22
- 256
- 341