Cleanup Git Repo (Rewrite)#

Warning

Do not do this on public repos unless you are absolutely sure what you are doing!

My homeassistant config is in a git repo (of course). No knowing any better, I added the database file config/home-assistant_v2.db. It is growing fast and I want to exclude it from the repo.

pip install git-filter-repo
git-filter-repo --invert-paths --path config/home-assistant_v2.db

Identify Large Files#

Via ChatGPT 4o:

git rev-list --objects --all |
  git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
  sed -n 's/^blob //p' |
  sort --numeric-sort --key=2 |
  cut -c 1-12,41- |
  numfmt --field=2 --to=iec |
  tail -n 10