Skip to content

Instantly share code, notes, and snippets.

@jacks0n
Created November 21, 2016 13:04
Show Gist options
  • Save jacks0n/dc317acf4e4e4a7d0d580c972740a186 to your computer and use it in GitHub Desktop.
Save jacks0n/dc317acf4e4e4a7d0d580c972740a186 to your computer and use it in GitHub Desktop.
Git maintenance commands
# Remove dangling commits/blobs.
git reflog expire --expire=now --all
# Verify connectivity and validity of the DB objects.
git fsck --full --unreachable
# Cleanup unused branches.
git remote | xargs --no-run-if-empty git remote prune
# Re-pack repository objects.
# @see https://gcc.gnu.org/ml/gcc/2007-12/msg00165.html
git repack -a -d --depth=250 --window=250
# Garbage collection.
git gc --prune=now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment