Created
April 28, 2016 19:25
-
-
Save ericzumba/e4f46162b0ccfcc1ed8fe56c74bd1c3a to your computer and use it in GitHub Desktop.
Git: Moving an internal folder to its own repo
This file contains 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
cp -r old-repo new-repo | |
cd new-repo | |
git remote rm origin | |
git clean -fd | |
git filter-branch --subdirectory-filter internal-folder -- branch-to-hold-on-to | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
git checkout branch-to-hold-on-to | |
git tag | xargs -I {} git tag -d {} | |
git branch | grep -v "*" | xargs -I {} git branch -D {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment