diff --git a/src/Actions/CodeUpAction.php b/src/Actions/CodeUpAction.php index 7483a2e..bef644f 100644 --- a/src/Actions/CodeUpAction.php +++ b/src/Actions/CodeUpAction.php @@ -21,6 +21,8 @@ class CodeUpAction extends StageAwareBaseAction */ protected $localVolume; + public $commitMessage = ''; + public function __construct( string $id, Commands $controller, @@ -91,7 +93,10 @@ public function run(?string $stage = null) if ($status = $git->getWorkingCopy()->getStatus()) { // Changed files $this->noteBlock('Uncommitted changes:' . PHP_EOL . $status); - $defaultMessage = $this->interactive ? null : 'init Craft'; + + $defaultMessage = $this->commitMessage ? $this->commitMessage : "Push latest to $upstream"; + //interactive must be false for custom commit message + $defaultMessage = $this->interactive ? null : $defaultMessage; if (! $msg = $this->ask( 'Enter a commit message, or leave it empty to abort the commit', @@ -115,9 +120,9 @@ public function run(?string $stage = null) } try { - $this->section("git push ($msg)"); + $this->section("git push ($msg) to $upstream from $branch to master"); $git->getWorkingCopy()->getWrapper()->streamOutput(); - $git->push($upstream, 'master'); + $git->push($upstream, "$branch:master"); } catch (GitException $exception) { $lines = count(explode(PHP_EOL, $exception->getMessage())); $this->output->write(str_repeat("\x1B[1A\x1B[2K", $lines)); diff --git a/src/Plugin.php b/src/Plugin.php index 3d0fffe..8756073 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -108,6 +108,7 @@ private function registerConsoleCommands(): void 'a' => 'app', 'e' => 'env', 'f' => 'force', + 'm' => 'commitMessage', ]; $group = (new ActionGroup('copy', 'Copy Craft between environments.'))