Created
March 18, 2010 15:38
-
-
Save pk/336478 to your computer and use it in GitHub Desktop.
Extract directory from the GIT repo to the standalone GIT 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
#!/bin/bash | |
FROM=$1 | |
TO=$2 | |
echo "Spliting '$TO' from '$FROM'" | |
git clone --no-hardlinks $FROM $TO | |
cd $TO | |
git filter-branch --subdirectory-filter $TO HEAD -- --all | |
git reset --hard | |
git gc --aggressive | |
git prune | |
echo "DONE!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a relevant question on StackOverflow (probably the source of the above script), with additional tips and variations:
http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository