Skip to content

Instantly share code, notes, and snippets.

@richfitz
Last active May 24, 2021 14:34
Show Gist options
  • Save richfitz/e27de2a2a62f5fcdcd69 to your computer and use it in GitHub Desktop.
Save richfitz/e27de2a2a62f5fcdcd69 to your computer and use it in GitHub Desktop.
git init
# Create a big file of random data (50 MB)
dd if=/dev/random of=bigblob.dat bs=5000000 count=10
git add bigblob.dat
git commit -m "Add big binary"
du -sh .git # about 48M
# Should be one big file in here:
ls -lRh .git/objects/[0-9a-z][0-9a-z]
# Duplicate the blob and add to repo:
cp bigblob.dat bigblob2.dat
git add bigblob2.dat
git commit -m "Add second big binary"
du -sh .git # still about 48 MB
# Still only one large object
ls -lRh .git/objects/[0-9a-z][0-9a-z]
# Look at the object hashes in git whatchanged - the'll both be the same
git whatchanged
# Get the hashes directly this way
git hash-object bigblob.dat
git hash-object bigblob2.dat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment