public function getActiveBranchName($defaultBranch = null)
{
$activeBranch = $this->processHelper->runCommand('git rev-parse --abbrev-ref HEAD');
// Detached head, use default branch
if ('HEAD' === $activeBranch) {
$activeBranch = $defaultBranch;
}
if (null === $activeBranch) {
throw new \RuntimeException('You are currently in a detached HEAD state, unable to get active branch-name.' . 'Please run `git checkout` first.');
}
return $activeBranch;
}