Skip to content

Instantly share code, notes, and snippets.

@ewheeler
Created November 9, 2009 21:38
Show Gist options
  • Save ewheeler/230293 to your computer and use it in GitHub Desktop.
Save ewheeler/230293 to your computer and use it in GitHub Desktop.
# adapted from http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository
# clone your rapidsms repo and name it rapidsms-core
cd rapidsms-core
# remove the apps directory:
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch apps" --prune-empty HEAD
git reset --hard
git remote rm origin
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive
git prune
# clone your rapidsms repo again and name it rapidsms-apps
cd rapidsms-apps
# remove everything except the apps directory:
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch DEVELOPMENT LICENSE MANIFEST.in README lib rapidsms rapidsms.ini rs_wsgi.py setup.py utilities" --prune-empty HEAD
git reset --hard
git remote rm origin
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive
git prune
# move all the apps to the root of the repository (rather than in apps/ directory)
git filter-branch --subdirectory-filter apps HEAD
git reset --hard
git gc --aggressive
git prune
# copy rapidsms-apps repo
cp -R rapidsms-apps rapidsms-contrib-apps
cd rapidsms-contrib-apps
# remove community apps
# NOTE: your apps may differ, so revise this list as necessary
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch airtime backends censor counter default django_extensions dropdupes echo ezsms fail feedback follow form fortune injector mathgame mctc modelrelationship nigeria patterns people persistance poll querylog questions reporting responder rwanda sms2irc socialsms supply tags tree" --prune-empty HEAD
git reset --hard
git gc --aggressive
git prune
# copy rapidsms-apps repo
cp -R rapidsms-apps rapidsms-community-apps
cd rapidsms-community-apps
# remove contrib apps
# NOTE: your apps may differ, so revise this list as necessary
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch ajax export httptester i18n locations logger messaging reporters training webui" --prune-empty HEAD
git reset --hard
git gc --aggressive
git prune
# now create three new repositories on your github page: rapidsms-core, rapidsms-community-apps, and rapidsms-contrib-apps
# and push your new repos up and delete rapidsms-apps
# clone your rapidsms-core, and add rapidsms-community-apps and rapidsms-contrib-apps as submodules
# http://daniel.collectiveidea.com/blog/2008/4/9/git-submodules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment