Forked from exalted/create-git-repo-from-subdirectory.sh
Created
July 9, 2018 02:02
-
-
Save 0rbadvent/696855afd15f99b02b934e69d17f9d5e to your computer and use it in GitHub Desktop.
Given a subdirectory extract separate repo out of an existing one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple | |
git filter-branch --prune-empty --subdirectory-filter foobar/ --tag-name-filter cat -- --all | |
# Complex | |
# (Ref.: http://stackoverflow.com/a/17867910/11895, | |
# http://stackoverflow.com/a/19957874/11895) | |
git filter-branch -f --prune-empty --index-filter \ | |
'git rm --cached --ignore-unmatch -r -q -- . ; \ | |
git reset -q $GIT_COMMIT -- .gitignore README.md foo/ bar/' \ | |
-- --all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment