Created
December 15, 2011 03:37
-
-
Save webframp/1479720 to your computer and use it in GitHub Desktop.
Bash script to split multi-cookbook repo into individual git repos, retaining history, and uploads to github
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 | |
for cookbook_dir in `ls community-cookbooks`; do | |
if [ $cookbook_dir != 'readme.md' ]; then | |
REPO=chef-$cookbook_dir | |
git clone --no-hardlinks ./community-cookbooks/ $REPO | |
SAVEDIR=`pwd` | |
cd $REPO | |
git filter-branch --subdirectory-filter $cookbook_dir HEAD -- --all --prune-empty | |
git reset --hard | |
rm -rf .git/refs/original/ | |
git reflog expire --expire=now --all | |
git gc --aggressive --prune=now | |
git remote rm origin | |
DESCRIPTION=`grep -w description metadata.rb | sed -e 's/^description[ \t]*//g'` | |
HOMEPAGE='http://heavywater.ca' | |
hub create heavywater/$REPO -d "$DESCRIPTION" -h $HOMEPAGE | |
git push origin master | |
cd $SAVEDIR | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment