Skip to content

Instantly share code, notes, and snippets.

@HansCz
Created April 13, 2012 21:09
Show Gist options
  • Save HansCz/2380212 to your computer and use it in GitHub Desktop.
Save HansCz/2380212 to your computer and use it in GitHub Desktop.
Git (Bash) - Filter branch
# Ref.: http://stackoverflow.com/a/359759/173679
git remote rm origin
git tag -l | xargs git tag -d
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter ABC HEAD
git reset --hard
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment