Hacker News new | ask | show | jobs
by hongsy 1896 days ago
i convinced myself that commits are snapshots by doing the following:

    # generate a 100M text file
    base64 -b 76 /dev/urandom | head  -c 100000000 > file.txt
    git add . && git commit -m "1"
    
    # remove first line and add a new line to bottom
    tail -n +2 file.txt > tmp && rm file.txt && mv tmp file.txt && base64 -b 76 /dev/urandom | head -n 1 >> file.txt
    git add . && git commit -m "2"
    
    # repeat
    tail -n +2 file.txt > tmp && rm file.txt && mv tmp file.txt && base64 -b 76 /dev/urandom | head -n 1 >> file.txt
    git add . && git commit -m "3"
    ...

    du -sh . # a very big folder
each of the commits are almost 80M big in the git folder. if you run `du -h .` you can see how git stores each object individually (80M big)