Skip to content

Instantly share code, notes, and snippets.

@FerraBraiZ
Forked from Zoramite/maintenance.sh
Last active March 23, 2024 12:50
Show Gist options
  • Save FerraBraiZ/2f33d2ffaa2378a94dab8a8ca1390d8c to your computer and use it in GitHub Desktop.
Save FerraBraiZ/2f33d2ffaa2378a94dab8a8ca1390d8c to your computer and use it in GitHub Desktop.
Git Maintenance Commands
#!/bin/bash -xe
# Verifies the connectivity and validity of the objects in the database
git fsck --full
# Manage reflog information
git reflog expire --expire=now --all
# Pack unpacked objects in a repository
git repack -a -d -l
# Cleanup unnecessary files and optimize the local repository and prune all unreachable objects from the object database
git gc --prune=now --aggressive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment