public function mergeBranch($base, $sourceBranch, $commitMessage, $fastForward = false)
{
$this->guardWorkingTreeReady();
$this->stashBranchName();
$this->checkout($base);
if ($fastForward) {
$this->processHelper->runCommand(['git', 'merge', '--ff', $sourceBranch]);
return trim($this->processHelper->runCommand('git rev-parse HEAD'));
}
$tmpName = $this->filesystemHelper->newTempFilename();
file_put_contents($tmpName, $commitMessage);
$this->processHelper->runCommands([['line' => ['git', 'merge', '--no-ff', '--no-commit', '--no-log', $sourceBranch], 'allow_failures' => false], ['line' => ['git', 'commit', '-F', $tmpName], 'allow_failures' => false]]);
return trim($this->processHelper->runCommand('git rev-parse HEAD'));
}