Skip to content

Instantly share code, notes, and snippets.

@wereHamster
Created April 11, 2010 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wereHamster/362574 to your computer and use it in GitHub Desktop.
Save wereHamster/362574 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