Skip to content

Instantly share code, notes, and snippets.

@corwin-of-amber
Created June 19, 2019 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corwin-of-amber/976d23184526a47ae4890b57b1a415bf to your computer and use it in GitHub Desktop.
Save corwin-of-amber/976d23184526a47ae4890b57b1a415bf to your computer and use it in GitHub Desktop.
# Based on:
# https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html
for m in "$@" ; do # jscoq/coq-pkgs/*.coq-pkg ; do
git filter-branch --index-filter "git rm --cached --ignore-unmatch $m" HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
done
# Prune all of the reflog references from now on back (unless you're explicitly only operating on one branch).
git reflog expire --expire=now --all
# Repack the repository by running the garbage collector and pruning old objects.
git gc --prune=now
# Push all your changes back to the remote repository.
git push --all --force
# Make sure all your tags are current too:
git push --tags --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment