protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Branch($dialoger); $currentBranch = $picker->getCurrent(); $branch = $picker->pickOneBut('HEAD is on <b>' . $currentBranch . '</b>\\n\\nPick one branch to <b>checkout</b>:', $currentBranch); $dialoger->runGit('checkout ' . $branch); $dialoger->dialogInfo('HEAD is now on branch <b>' . $branch . '</b>'); }
protected function run(\DialoGit\Dialoger $dialoger) { $remotesPicker = new \DialoGit\Picker\Remote($dialoger); $remote = $remotesPicker->pickOne('Pick one remote repository from to <b>pull</b>:'); $branchesPicker = new \DialoGit\Picker\Branch($dialoger); $branch = $branchesPicker->pickOne('Pick one branch to <b>pull</b>:'); $dialoger->runGitOnNewShell('pull ' . $remote . ' ' . $branch); }
protected function run(\DialoGit\Dialoger $dialoger) { $newBranch = $dialoger->dialogInput('New branch name:'); $picker = new \DialoGit\Picker\Branch($dialoger); $currentBranch = $picker->getCurrent(); $dialoger->runGit('branch ' . $newBranch); if ($dialoger->dialogQuestion('HEAD is on <b>' . $currentBranch . '</b>\\n\\nDo you want to checkout the new branch now?')) { $dialoger->runGit('checkout ' . $newBranch); $dialoger->dialogInfo('HEAD is now on branch <b>' . $newBranch . '</b>'); } }
protected function run(\DialoGit\Dialoger $dialoger) { $remotesPicker = new \DialoGit\Picker\Remote($dialoger); $remotes = $remotesPicker->pickMany('Pick one or more remotes repositories on to <b>push</b>:'); $branchesPicker = new \DialoGit\Picker\Branch($dialoger); $branches = $branchesPicker->pickMany('Pick one or more branches to <b>push</b>:'); foreach ($remotes as $remote) { foreach ($branches as $branch) { $dialoger->runGitOnNewShell('push ' . $remote . ' ' . $branch); sleep(1); } } }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Branch($dialoger); $branches = $picker->getStructures(); if (count($branches) == 1) { $dialoger->dialogError('There is only one local branch right now.'); $dialoger->error(); } $currentBranch = $picker->getCurrent(); $branches = $picker->pickManyBut('HEAD is on <b>' . $currentBranch . '</b>\\n\\nPick one or more local branches to <b>delete</b>:', $currentBranch); $thisThese = count($branches) == 1 ? 'this local branch' : 'these local branches'; $dialoger->dialogConfirm('Do you wish to <b>delete</b> ' . $thisThese . ' for sure?\\n\\n' . implode("\n", $branches)); foreach ($branches as $branch) { $dialoger->runGit('branch -d ' . $branch); } }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Branch($dialoger); $branches = $picker->getStructures(); if (count($branches) == 1) { $dialoger->dialogError('There is only one local branch right now.'); $dialoger->error(); } $currentBranch = $picker->getCurrent(); if ($picker->isHeadOnBranch()) { $branch = $picker->pickOneBut('HEAD is on <b>' . $currentBranch . '</b>\\n\\nPick one local branch to <b>merge</b> with:', $currentBranch); $dialoger->dialogConfirm('Do you want to modify <b>' . $currentBranch . '</b> by merging the contents of <b>' . $branch . '</b> into it?'); $dialoger->runGit('merge ' . $branch); } else { $dialoger->dialogError('Merge requires HEAD to be on a branch, but HEAD is on <b>' . $currentBranch . '</b>, which is not a branch.'); $dialoger->error(); } }