Skip to content

Instantly share code, notes, and snippets.

@kszarek
Created November 4, 2015 11:24
Show Gist options
  • Save kszarek/91e2ad44a53ccd7a78cc to your computer and use it in GitHub Desktop.
Save kszarek/91e2ad44a53ccd7a78cc to your computer and use it in GitHub Desktop.
Migrate cookbook between 2 git repos
#!/bin/bash -xe
if [[ $1 == "" ]]
then
echo "$0 cookbook_name"
exit 1
fi
cookbook_name=$1
cd /Users/marvik/workspace/sr
git clone [email protected]:smartrecruiters/chef.git tmp_chef
cd tmp_chef
git remote rm origin
git filter-branch --subdirectory-filter cookbooks/$cookbook_name -- --all
mkdir $cookbook_name
for x in `ls -1|grep -v $cookbook_name`
do
mv $x $cookbook_name/
done
git add .
git ci -m 'Move cookbook to proper directory' -a
git remote add origin [email protected]:smartrecruiters/monitoring-cookbooks.git
git pull origin master
git push --set-upstream origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment