Skip to content

Instantly share code, notes, and snippets.

@co3k
Created March 31, 2010 02:43
Show Gist options
  • Save co3k/349871 to your computer and use it in GitHub Desktop.
Save co3k/349871 to your computer and use it in GitHub Desktop.
定期的に git-svn rebase して push するやつ
<?php
require_once 'VersionControl/Git.php';
$git = new VersionControl_Git('/path/to/OpenPNE2-git-mirror');
$git->setGitCommandPath('/path/to/git');
$branches = $git->getBranches();
foreach ($branches as $branch)
{
$git->checkout($branch);
$git->getCommand('svn rebase')->execute();
$git->getCommand('push')
->addArgument('origin')
->addArgument($branch)
->execute();
}
$tags = $git->getTags();
$remote_branches = $git->getRemoteBranches('tags');
foreach ($remote_branches as $remote_branch)
{
if (false !== strpos($remote_branch, '@'))
{
continue;
}
if (isset($tags[$remote_branch]))
{
continue;
}
$git->checkout('tags/'.$remote_branch);
$git->getCommand('tag')
->addArgument($remote_branch)
->execute();
}
$git->getCommand('push')
->addArgument('origin')
->setOption('tags')
->execute();
$git->checkout('master');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment