Reputation: 9418
What's the best way to tell how much extra disk space a commit will use in the repo?
Upvotes: 1
Views: 501
Reputation: 301497
First of all, the commit itself wouldn't take much disk space as it is just a pointer to a tree and the previous commit. The objects are already written. So the other answer of measuring disk usage before and after a commit is not really helpful to what you really want ( or what I think you want)
With that said, you can look at using the plumbing commands like git write-tree
and git hash-object
to see how much space the objects for the changes that the commit is going to add.
http://book.git-scm.com/7_raw_git.html
Upvotes: 0
Reputation: 231403
Measure the disk usage prior to the commit. Perform the commit, then measure again. The difference between the two measurements is the amount of disk space needed. Note that the space used may end up decreasing significantly after a git gc
run.
Upvotes: 1