Skip to content

Instantly share code, notes, and snippets.

@selfup
Last active September 18, 2019 17:08
Show Gist options
  • Save selfup/0e4a47045d0b5bb49209e67c031db02c to your computer and use it in GitHub Desktop.
Save selfup/0e4a47045d0b5bb49209e67c031db02c to your computer and use it in GitHub Desktop.
git branch -r | grep -v /HEAD
for remote in `git branch -r | grep -v /HEAD`; do; git checkout --track $remote; done
git checkout master
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch my_dir/' --prune-empty --tag-name-filter cat -- --all
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
rm -Rf .git/logs .git/refs/original
git gc --prune=all --aggressive
git push origin --all --force
git push origin --tags --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment