r/webdev • u/fagnerbrack • 14h ago
How big is a Git commit?
https://ratfactor.com/cards/git-commit-size19
u/cornovum77 12h ago
I think most of these files are 4K because that is the smallest block allocation. ‘du’ shows block space.
1
u/EnderAvni 8h ago
I could be wrong, but do you mean page size or block allocation? I think on the heap it's like 8b minimum or something
3
u/International_Sky526 4h ago
block allocation, not page size. the 4k is the filesystem block size, which is the default on ext4 and the default cluster size on ntfs. it only happens to match the 4k memory page size on x86, they are unrelated things. a 100 byte file still takes one whole 4k block on disk. du reports allocated blocks, while du --apparent-size or ls -l shows the real byte count.
8
1
11h ago
[removed] — view removed comment
1
u/webdev-ModTeam 5h ago
Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.
0
-1
0
10h ago
[removed] — view removed comment
1
u/webdev-ModTeam 5h ago
Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.
0
-1
-6
u/Mistr_John_Alex 11h ago
Most people assume a commit's size tracks the files changed, but the commit itself is just a small object holding the tree, parent, author, and message. The size you get from the object inspection command is that object, not the diff or the blobs that hold file contents. A tiny change and a huge change can produce nearly the same commit size; what grows is usually the number of parents or the message length. Are you trying to estimate repo size for a migration, or just figure out what an individual commit weighs?
3
49
u/ggnndd12 13h ago
2cm