Skip to content

Instantly share code, notes, and snippets.

@zaqmor
Last active April 12, 2019 22:07
Show Gist options
  • Save zaqmor/254b48c9dda7ce2478f50fd74ae8d347 to your computer and use it in GitHub Desktop.
Save zaqmor/254b48c9dda7ce2478f50fd74ae8d347 to your computer and use it in GitHub Desktop.
Cleaning up the git reflog
# 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