Skip to content

Instantly share code, notes, and snippets.

@aufrank
Forked from wereHamster/git-flush
Created April 12, 2010 18:39
Show Gist options
  • Save aufrank/363868 to your computer and use it in GitHub Desktop.
Save aufrank/363868 to your computer and use it in GitHub Desktop.
#!/bin/sh
# The job of git-flush is to recompactify your repository to be as small
# as possible, by dropping all reflogs, stashes, and other cruft that may
# be bloating your pack files.
git for-each-ref --format="%(refname)" refs/original/ | \
xargs -n 1 git update-ref -d
git reflog expire --expire=0 --all
if [ "$1" = "-f" ]; then
git stash clear
fi
git gc --prune=now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment