Daniel Lockyer

Daniel Lockyer

Performance and scaling consultant who analyzes the full stack - frontend, backend and infrastructure - to generate more revenue and cut costs for businesses.

Remote • Available for monthly retainer and bespoke projects.

Book a Call

Find the largest unstaged files in Git

I was recently adding a bunch of files to a new Git repo, but I couldn't be sure if I was about to commit a 100MB file. The following bash command should print out a sorted list of unstaged files and their size, so you can check if you are about to do the same.

git status -u --porcelain | sed 's/^...//;s/^"//;s/"$//' | while read path; do du -bs "$path"; done | sort -n