Skip to content

Instantly share code, notes, and snippets.

@ralphschindler
Created July 18, 2012 21:13
Show Gist options
  • Save ralphschindler/3138941 to your computer and use it in GitHub Desktop.
Save ralphschindler/3138941 to your computer and use it in GitHub Desktop.
Wow, really?
<?php
$service = 'Amazon';
chdir(__DIR__);
`git clone ./zf2 ZendService{$service}-library`;
`git clone ./zf2 ZendService{$service}-tests`;
chdir(__DIR__ . '/ZendService' . $service . '-library');
`git tag -l | xargs git tag -d`;
`git filter-branch --subdirectory-filter library/Zend/Service/{$service} -- --all`;
`git filter-branch -f --index-filter 'git ls-files -s | sed "s-\t-\tlibrary/ZendService/{$service}/-g" | GIT_INDEX_FILE=\$GIT_INDEX_FILE.new git update-index --index-info && [ -e "\$GIT_INDEX_FILE.new" ] && mv "\$GIT_INDEX_FILE.new" "\$GIT_INDEX_FILE" || : ' HEAD`;
chdir(__DIR__ . '/ZendService' . $service . '-tests');
`git tag -l | xargs git tag -d`;
`git filter-branch --subdirectory-filter tests/Zend/Service/{$service} -- --all`;
`git filter-branch -f --index-filter 'git ls-files -s | sed "s-\t-\ttests/ZendService/{$service}/-g" | GIT_INDEX_FILE=\$GIT_INDEX_FILE.new git update-index --index-info && [ -e "\$GIT_INDEX_FILE.new" ] && mv "\$GIT_INDEX_FILE.new" "\$GIT_INDEX_FILE" || : ' HEAD`;
chdir(__DIR__);
`git init ZendService{$service};`;
chdir(__DIR__ . '/ZendService' . $service);
`touch README.md`;
`git add README.md`;
`git commit -m "Initial Commit of README.md"`;
`git remote add -f library ../ZendService{$service}-library;`;
`git remote add -f tests ../ZendService{$service}-tests`;
`git merge -s ours --no-commit library/master`;
`git read-tree --prefix=/ -u library/master`;
`git commit -m "Merging in ./library for ZendService\\{$service}"`;
`git merge -s ours --no-commit tests/master`;
`git read-tree --prefix=/ -u tests/master`;
`git commit -m "Merging in ./tests for ZendService\\{$service}"`;
`git remote add origin https://github.com/zendframework/ZendService{$service}.git`;
`git push -u origin master`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment