Last active
April 9, 2025 22:00
-
-
Save zaqmor/254b48c9dda7ce2478f50fd74ae8d347 to your computer and use it in GitHub Desktop.
Cleaning up the git reflog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Purge the reflog of anything farther back than 180 days, specifying --all, otherwise unreachable 'dangling' objects will be missed, | |
# optional --expire-unreachable flag could differ on when to expire unreachables | |
git reflog expire --all --expire=180.days.ago --expire-unreachable=180.days.ago --all | |
# other examples for expire | |
--expire=now | |
--expire=never | |
--expire="Jan 01 2019" | |
--expire="2019-01-01 00:00" | |
# Pruning actually does the cleanup, after reflog expire marks the references as expired | |
# --prune=now means ignore the 90 day prune default and prune starting now | |
git gc --prune=now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment