Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 573 Bytes

git-gc.md

File metadata and controls

21 lines (14 loc) · 573 Bytes

< Back to Nuggets


Reduce local Git folder size

When working with a git repository for a long time, the .git folder can become quite bloated. Here is how to clean up with the commands git reflog and git gc.

# Check `.git` folder size
du -sh .git

# Prune older reflog entries
git reflog expire --all --expire=now

# Cleanup unnecessary files and optimize the local repository
git gc --prune=now --aggressive

# Recheck folder size. Should be lower now.
du -sh .git