Tue 06 Sep 2016 — Mon 22 Jan 2018

Git

Searching Logs

This is called the Git pickaxe.

Use git log -p to show diffs. Nice.

Use git log -S to search for text.

Large Files

There are an assortment of solutions on Stackoverflow. I like this one:

git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| awk '/^blob/ {print substr($0,6)}' \
| sort --numeric-sort --key=2 \
| cut --complement --characters=13-40 \
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest

To remote the identified files:

LARGE_FILE="my-large-file.csv"

git filter-branch \
    --prune-empty -d /dev/shm/scratch \
    --index-filter "git rm --cached -f --ignore-unmatch ${LARGE_FILE}" \
    --tag-name-filter cat -- --all