#!/bin/sh # Scrub a Git repository for arg in "${@:-.}" ; do ( case $arg in *.git) cd -- "$arg" || exit ;; *) cd -- "$arg"/.git || exit ;; esac git fsck || exit git reflog expire --expire=now || exit git gc --prune=now --aggressive || exit ) done