Skip to content

Instantly share code, notes, and snippets.

@Gnappuraz
Last active September 6, 2017 19:38
Show Gist options
  • Select an option

  • Save Gnappuraz/b66b5559c70fca346e232dc5671dff1c to your computer and use it in GitHub Desktop.

Select an option

Save Gnappuraz/b66b5559c70fca346e232dc5671dff1c to your computer and use it in GitHub Desktop.
Git filter-branch
Here's a good way to clean the repo up after filter-branch:
git remote rm origin
rm -rf .git/refs/original/ .git/refs/remotes/ .git/*_HEAD .git/logs/
git for-each-ref --format="%(refname)" refs/original/ | xargs -n1 --no-run-if-empty git update-ref -d
And then:
git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 \
-c gc.rerereunresolved=0 -c gc.pruneExpire=now gc "$@" --aggressive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment