Created
November 4, 2015 11:24
-
-
Save kszarek/91e2ad44a53ccd7a78cc to your computer and use it in GitHub Desktop.
Migrate cookbook between 2 git repos
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 -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