Skip to content

Instantly share code, notes, and snippets.

@evnm
Last active December 21, 2015 01:28
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 evnm/6227816 to your computer and use it in GitHub Desktop.
Save evnm/6227816 to your computer and use it in GitHub Desktop.
A Git maintenance script. Prunes remote-tracking branches on origin and performs a deep repack on the repository.
#! /bin/sh
# A Git maintenance script.
set -e
root=`git rev-parse --show-toplevel`
echo "Performing maintenance tasks on Git repository in ${root}..."
git fetch
git remote prune origin
git repack -a -d --depth=250 --window=250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment