mewmew / playground

random
The Unlicense
7 stars 5 forks source link

howto: split repo #10

Closed mewmew closed 6 years ago

mewmew commented 6 years ago

ref: https://github.com/faiface/pixel/issues/135

Approach used to clean the main repo:

ref: https://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-git-repo

git filter-branch -f --tree-filter 'rm -rf examples' HEAD
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now

ref: https://blog.ostermiller.org/git-remove-from-history

git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch examples' --prune-empty -f -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now

Went from 90 MB to 4 MB.

mewmew commented 6 years ago

Approach taken to split examples into dedicated repo:

From https://stackoverflow.com/a/17864475

cd pixel
git subtree split -P examples -b examples-only
cd ..
mkdir pixel-examples
cd pixel-examples
git init
git pull ../pixel examples-only

Size of pixel-examples repo: 90 MB.