diff --git a/src/workflow/ArcanistUpgradeWorkflow.php b/src/workflow/ArcanistUpgradeWorkflow.php --- a/src/workflow/ArcanistUpgradeWorkflow.php +++ b/src/workflow/ArcanistUpgradeWorkflow.php @@ -27,7 +27,11 @@ } public function getArguments() { - return array(); + return array( + 'force' => array( + 'help' => 'Forces an upgrade, discarding all local commits.', + ) + ); } public function run() { @@ -66,11 +70,16 @@ } chdir($root); - try { - phutil_passthru('git pull --rebase'); - } catch (Exception $ex) { - phutil_passthru('git rebase --abort'); - throw $ex; + if ($this->getArgument('force')) { + phutil_passthru('git fetch origin master'); + phutil_passthru('git reset --hard origin/master'); + } else { + try { + phutil_passthru('git pull --rebase'); + } catch (Exception $ex) { + phutil_passthru('git rebase --abort'); + throw $ex; + } } }