Created
June 8, 2014 19:12
-
-
Save bewt85/229420f124e807766321 to your computer and use it in GitHub Desktop.
Script to help split a project into sub-modules
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
#!/bin/bash | |
set -ex | |
ROOT_DIR=$(cd $(dirname $1); pwd)/$(basename $1) | |
START_DIR=$(pwd) | |
[[ -d ${START_DIR}/splits ]] || mkdir ${START_DIR}/splits | |
for subProject in $(find $ROOT_DIR -mindepth 1 -maxdepth 1 -type d | grep -v git); do | |
cd $ROOT_DIR | |
dest_dir=${START_DIR}/splits/$(basename $subProject) | |
cp -r ${ROOT_DIR} $dest_dir | |
cd $dest_dir | |
git filter-branch --subdirectory-filter $(basename $subProject)/ -- master | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment