We are using throwaway integration branches which are pushed, and then later deleted and recreated. However the discarded branches are leaving dangling commits and trees which I can view with this command: git fsck --unreachable --no-reflogs
I could clean them up with
git reflog expire --expire-unreachable=now --all
git gc --prune=now
or something similar, but I want to understand the scope of these commands and related configuration first.
So the specific questions:
- So that new clones are lean, how can I
gc
prune and clear the reflogs, not just locally but also on our remote repository hosted on GitHub? - Can I set the related git config items (e.g.
gc.pruneexpire
,gc.reflogexpire
,gc.reflogexpireunreachable
) for the GitHub hosted repository?
P.S.: See here for useful context: Listing and deleting Git commits that are under no branch (dangling?)