Thursday, April 12, 2012

Quickest way to split up multiple pear packages into different git repositories

I was doing it the hard way before, but now:
$ git clone git@github.com:pear/Validate.git

# Go hit https://github.com/organizations/pear/repositories/new to make a new repo

$ git clone git@github.com:pear/Validate_CA.git

$ cd Validate_CA 

$ git pull git@github.com:pear/Validate.git

$ git rm -r *

$ pear list ../Validate/package_CA.xml | grep ".* /" | cut -f 1 -d " " | xargs git reset HEAD

$ pear list ../Validate/package_CA.xml | grep ".* /" | cut -f 1 -d " " | xargs git checkout --

$ git commit -m "Splitting off to own package"

$ git push -u origin master

$ cd ..

$ cd Validate

$ pear list package_CA.xml | grep ".* /" | cut -f 1 -d " " | xargs git rm

$ git rm package_CA.xml

$ git reset HEAD LICENSE

$ git checkout -- LICENSE

$ git commit -m "Splitting off to own package"

$ git push
Post a Comment