On Tue, 5 Apr 2011 11:23:38 +0300
Artiom Di <kro...@gmail.com> wrote:

> I have such commit:
> $ git log -n1 --pretty=format:commit -m --first-parent --no-prefix
> --shortstat 1e68e16e7f06868210d63bb1623b976dcedd65e4 commit
>  2 files changed, 1290965 insertions(+), 5 deletions(-)
> This operation consumes aprox 1.5Gb RAM.
> The question is: how to see if some given commit is really huge and
> not to load whole commit in RAM?
Each commit references a tree object which, in turn, references a set of
blobs and/or other tree objects referencing their own sets of blobs etc.
This hierarchy of trees represents the state of your index from which a
commit has been made.  IOW, "the size of a commit" is not recorded
anywhere explicitly--even in tree objects, and you have to inspect the
whole hierarchy of trees referenced by a commit to calculate its size.
This is not really hard as Git has low-level commands to read tree
objects and blobs.  On the other hand, I can't easily find any way to
know the size of a blob other than using
`git cat-file blob $SHA1 | wc -c`.
Note also that "the size of a commit" is a vague term: I might have a
one gigabyte file tracked in my repository; then I change a single byte
in it and make a commit--what should really count as the size of this
commit?  The change itself is only one byte, the blob representing this
change is one gigabyte.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to