Skip to content

Instantly share code, notes, and snippets.

@mhermans
Forked from rip747/split_repo.bash
Created January 10, 2013 02:10
Show Gist options
  • Save mhermans/4498786 to your computer and use it in GitHub Desktop.
Save mhermans/4498786 to your computer and use it in GitHub Desktop.
#!/bin/bash
FROM=$1 #/cygdrive/c/temp/oldrepo
TO=$2 #/cygdrive/c/temp/newrepo
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
git remote rm origin
echo "DONE!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment