---
title: "Ricky on Hey: \"I'm probably dumb for not knowing this…\""
description: "I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Useful for catching large files that you might have not…"
url: "https://hey.xyz/posts/c07de7txzse7x5nk7h"
image: "https://ik.imagekit.io/lens/tr:w-1000,h-1000,q-100/01e2dd315c3842452949eb39b30d868f44e3ddf4f814a4b2d394029d7255eca4_Jv8KMYzZP.webp"
---

# I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Usefu…

6 comments · 2025-05-31T10:27:25+00:00

[@rickydata](https://hey.xyz/u/rickydata) (Ricky)

I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Useful for catching large files that you might have not caught in your .gitignore, and avoiding a situation where you can't push a commit due to large file size. No dependencies, this is a git feature, you could save the below in .git/hooks/pre-commit, which would make sure to exclude any files above 50MB when you make your commits: \\ # Check for files larger than 50MB largefiles=$(git diff --cached --name-only --diff-filter=A | xargs -I {} find {} -size +50M 2>/dev/null) if [ -n "$largefiles" ]; then echo "Error: The following files are larger than 50MB and cannot be committed:" echo "$large_files" echo "Please remove these files or add them to .gitignore" exit 1 fi \\

[Profile](https://hey.xyz/u/rickydata) · [Hey](https://hey.xyz) · [Permalink](https://hey.xyz/posts/c07de7txzse7x5nk7h)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://hey.xyz/posts/c07de7txzse7x5nk7h#post","@type":"SocialMediaPosting","author":{"@id":"https://hey.xyz/u/rickydata#person","@type":"Person","alternateName":"rickydata","identifier":"0x9E4dcd6A6b0b690e64423f08FF4CB970A08902a4","image":"https://ik.imagekit.io/lens/tr:w-1200,h-630,q-100/01e2dd315c3842452949eb39b30d868f44e3ddf4f814a4b2d394029d7255eca4_Jv8KMYzZP.webp","name":"Ricky","url":"https://hey.xyz/u/rickydata"},"comment":[{"@id":"https://hey.xyz/posts/33147mjxawp34w6g634#post","@type":["Comment","SocialMediaPosting"],"author":{"@id":"https://hey.xyz/u/andrija#person","@type":"Person","alternateName":"andrija","name":"Andrija","url":"https://hey.xyz/u/andrija"},"dateCreated":"2025-05-31T13:22:49+00:00","dateModified":"2025-05-31T13:22:49+00:00","datePublished":"2025-05-31T13:22:49+00:00","interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":1}],"text":"Had no idea as well 😳","url":"https://hey.xyz/posts/33147mjxawp34w6g634"},{"@id":"https://hey.xyz/posts/61y57xew0b9fv6z34k#post","@type":["Comment","SocialMediaPosting"],"author":{"@id":"https://hey.xyz/u/kaimanzuzuzu#person","@type":"Person","alternateName":"kaimanzuzuzu","name":"zuzuzu","url":"https://hey.xyz/u/kaimanzuzuzu"},"dateCreated":"2025-05-31T16:02:28+00:00","dateModified":"2025-05-31T16:02:28+00:00","datePublished":"2025-05-31T16:02:28+00:00","text":"take it easy sir","url":"https://hey.xyz/posts/61y57xew0b9fv6z34k"},{"@id":"https://hey.xyz/posts/3jzdxmb7ardvfvtmn68#post","@type":["Comment","SocialMediaPosting"],"author":{"@id":"https://hey.xyz/u/velokun#person","@type":"Person","alternateName":"velokun","name":"velo","url":"https://hey.xyz/u/velokun"},"dateCreated":"2025-05-31T19:51:31+00:00","dateModified":"2025-05-31T19:51:31+00:00","datePublished":"2025-05-31T19:51:31+00:00","text":"folback please 🥲","url":"https://hey.xyz/posts/3jzdxmb7ardvfvtmn68"},{"@id":"https://hey.xyz/posts/3nm698zhtrq41vf6e6q#post","@type":["Comment","SocialMediaPosting"],"author":{"@id":"https://hey.xyz/u/brunormotaa_#person","@type":"Person","alternateName":"brunormotaa_","name":"Bru","url":"https://hey.xyz/u/brunormotaa_"},"dateCreated":"2025-05-31T11:49:20+00:00","dateModified":"2025-05-31T11:49:20+00:00","datePublished":"2025-05-31T11:49:20+00:00","text":"handy hook trick","url":"https://hey.xyz/posts/3nm698zhtrq41vf6e6q"},{"@id":"https://hey.xyz/posts/1sbxgkj0kyx6m00tq14#post","@type":["Comment","SocialMediaPosting"],"author":{"@id":"https://hey.xyz/u/raqibjaved#person","@type":"Person","alternateName":"raqibjaved","name":"raqibjaved","url":"https://hey.xyz/u/raqibjaved"},"dateCreated":"2025-05-31T10:58:53+00:00","dateModified":"2025-05-31T10:58:53+00:00","datePublished":"2025-05-31T10:58:53+00:00","text":"LFG","url":"https://hey.xyz/posts/1sbxgkj0kyx6m00tq14"}],"commentCount":6,"dateCreated":"2025-05-31T10:27:25+00:00","dateModified":"2025-05-31T10:27:25+00:00","datePublished":"2025-05-31T10:27:25+00:00","headline":"I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Usefu…","interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":104},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":28,"name":"Shares"},{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6}],"isPartOf":{"@id":"https://hey.xyz/#website"},"potentialAction":[{"@type":"CommentAction","target":{"@type":"EntryPoint","urlTemplate":"https://hey.xyz/posts/c07de7txzse7x5nk7h"}},{"@type":"LikeAction","target":{"@type":"EntryPoint","urlTemplate":"https://hey.xyz/posts/c07de7txzse7x5nk7h"}},{"@type":"ShareAction","name":"Repost","target":{"@type":"EntryPoint","urlTemplate":"https://hey.xyz/posts/c07de7txzse7x5nk7h"}}],"text":"I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Useful for catching large files that you might have not caught in your .gitignore, and avoiding a situation where you can't push a commit due to large file size. No dependencies, this is a git feature, you could save the below in .git/hooks/pre-commit, which would make sure to exclude any files above 50MB when you make your commits: \\\\ # Check for files larger than 50MB largefiles=$(git diff --cached --name-only --diff-filter=A | xargs -I {} find {} -size +50M 2>/dev/null) if [ -n \"$largefiles\" ]; then echo \"Error: The following files are larger than 50MB and cannot be committed:\" echo \"$large_files\" echo \"Please remove these files or add them to .gitignore\" exit 1 fi \\\\","url":"https://hey.xyz/posts/c07de7txzse7x5nk7h","about":[{"@type":"DefinedTerm","name":"#large","url":"https://hey.xyz/search?q=%23large&type=posts"}],"keywords":["large"]},{"@id":"https://hey.xyz/posts/c07de7txzse7x5nk7h#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","item":"https://hey.xyz","name":"Hey","position":1},{"@type":"ListItem","item":"https://hey.xyz/u/rickydata","name":"Ricky","position":2},{"@type":"ListItem","item":"https://hey.xyz/posts/c07de7txzse7x5nk7h","name":"I'm probably dumb for not knowing this until Claude taught…","position":3}]},{"@id":"https://hey.xyz/posts/c07de7txzse7x5nk7h","@type":"WebPage","breadcrumb":{"@id":"https://hey.xyz/posts/c07de7txzse7x5nk7h#breadcrumb"},"mainEntity":{"@id":"https://hey.xyz/posts/c07de7txzse7x5nk7h#post"},"url":"https://hey.xyz/posts/c07de7txzse7x5nk7h"}]}
```
