0

I would like to find out how much total hard drive space a specific file takes up in a local git repository (working tree and commit history combined). In other words I'd like to find out how much smaller the repository would get if I removed a specific file from the git history.

How could I do that?

Thomas Fritz
  • 140
  • 2
  • 10
  • 2
    Does this answer your question? [How to see the file size history of a single file in a git repository?](https://stackoverflow.com/questions/3150727/how-to-see-the-file-size-history-of-a-single-file-in-a-git-repository) – CodeCaster Apr 20 '23 at 13:20
  • Hmm not really. I'd like to know how much total disk space I would save if I'd completely remove a file from the git history, not how big that file used to be at specific commits. – Thomas Fritz Apr 20 '23 at 13:59
  • The sum of the latter will be the former. – CodeCaster Apr 20 '23 at 14:00
  • 2
    The way git repos are compressed means that it's difficult to predict the effect of removing a file and its history. The delta pack might be using that file as a delta basis for a file you decided to keep, in which case the savings could be as low as zero. The only way for sure is to try it in a clone and see what happens. – Raymond Chen Apr 20 '23 at 19:04

0 Answers0