Skip to content

Instantly share code, notes, and snippets.

@vchuravy
Created September 2, 2016 18:16
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 vchuravy/81de73d34ed2b24de3123f50bb3c5bbd to your computer and use it in GitHub Desktop.
Save vchuravy/81de73d34ed2b24de3123f50bb3c5bbd to your computer and use it in GitHub Desktop.
Extracting sparse array files...
# http://stackoverflow.com/questions/5998987/splitting-a-set-of-files-within-a-git-repo-into-their-own-repository-preserving
# Takes some while to run 1000s
git filter-branch \
--prune-empty \
--index-filter '
git ls-tree -z -r --name-only --full-tree $GIT_COMMIT \
| grep -z -v "^base/sparse" \
| grep -z -v "^test/sparse.jl" \
| grep -z -v "^doc/manual/linear-algebra.rst" \
| grep -z -v "^doc/manual/arrays.rst" \
| xargs -0 -r git rm --cached -r
' \
-- \
master
@vchuravy
Copy link
Author

vchuravy commented Sep 2, 2016

Cleanup afterwards:

git filter-branch --prune-empty --parent-filter 'sed "s/-p //g" | xargs -r git show-branch --independent | sed "s/\</-p /g"'
git reset --hard
git gc --aggressive
git prune
git remote rm origin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment