A couple of quick additions to my dotfiles today:
git find-fat- find large files that no longer exist
git trim-fat- remove files entirely from git history
Both come courtesy of GitHub user cmaitchison, specifically from his git_diet repository.
The code12 is a little opaque, although it’s neat if you’re into bash scripts. Honestly though, you mostly only need to use them. For that, here’s an example:
# Find the 20 (-n) largest blobs that no longer exist (-d) $ git find-fat -n 20 -d # From just the filenames (-f), remove those files from the git history $ git find-fat -n 20 -d -f | git trim-fat
One thing I really love about
git is how it works with files on your path named
git-*. So I can use
git find-fat rather than needing
git-find-fat, just as if it were built into
git. It’s not that big of a deal, but I still think it’s neat.