Skip to content

Instantly share code, notes, and snippets.

@vdemeester
Created April 15, 2019 11:08
Show Gist options
  • Save vdemeester/bfc053833f7d76419df2e5457998a772 to your computer and use it in GitHub Desktop.
Save vdemeester/bfc053833f7d76419df2e5457998a772 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
KEEP_FILES="openshift|.gitignore|LICENSE|Makefile|OWNERS|OWNERS_ALIASES"
git filter-branch --prune-empty -f --index-filter "git ls-tree --name-only HEAD . | grep -vE '$KEEP_FILES' | xargs git rm -r --cached --ignore-unmatch FOO" HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment