Returns the current branch of the local repository referenced in the webhook.

@return string $current_branch Default return is 'master'.
491993
private function get_local_branch() {
		$repo = false;
		if ( isset( $_REQUEST['plugin'] ) ) {
			$repos = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
			$repo  = isset( $repos[ $_REQUEST['plugin'] ] ) ? $repos[ $_REQUEST['plugin'] ] : false;
		}
		if ( isset( $_REQUEST['theme'] ) ) {
			$repos = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
			$repo  = isset( $repos[ $_REQUEST['theme'] ] ) ? $repos[ $_REQUEST['theme'] ] : false;
		}
		$current_branch = $repo ?
			Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo ) :
			'master';

		return $current_branch;
	}
833202
protected function getLastTagOnBranch($current_branch) {
    // List all tags, sort numerically, and filter out any that aren't numeric.
    $output = $this->taskExecStack()
      ->exec("git -c 'versionsort.suffix=-' tag --sort=-v:refname --merged $current_branch | sed '/^[[:alpha:]]/d'")
      ->interactive(FALSE)
      ->silent(TRUE)
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run()
      ->getMessage();
    $tags_on_branch = explode("\n", $output);
    $prev_tag = reset($tags_on_branch);

    return $prev_tag;
  }
344465
function isCurrentBranch( branch ) {
      return function() {
        var deferred = Q.defer();

        Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
          .then(function( data ) {
            //console.log('data=',data);
            if ( data && data.trim() === branch ) {
              deferred.resolve(true);
            }
            else {
              throw new Error(format('Error. Branch [%s] is not the current branch. Output:[%s]', branch, data.trim()));
            }
          })
          .catch(function( err ) {
            console.log('err=',err);
            deferred.reject(err);
          });
        return deferred.promise;
      };
    }
1279705
public function current()
    {
        if (is_null($this->current)) {
            $this->current = current($this->branch);
        }
        if ($this->current instanceof RecursiveLeafInterface) {
            return $this->current->current();
        }

        return false;
    }
543518
public function getCurrentRemote()
    {
        /** @var $result CallResult */
        $result = $this->getGit()->{'remote'}($this->getRepositoryPath(), array(
             '-v'
        ));
        $result->assertSuccess(sprintf('Cannot remote "%s"', $this->getRepositoryPath()));

        $tmp = $result->getStdOut();

        preg_match_all('/([a-z]*)\h(.*)\h\((.*)\)/', $tmp, $matches);

        $retVar = array();
        foreach($matches[0] as $key => $value)
            $retVar[$matches[1][$key]][$matches[3][$key]] = $matches[2][$key];

        return $retVar;
    }
1005582
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;
    }
678004
def _get_branches(self):
        """"""
        if self.offline:
            local_path = Path(LOCAL_PATH).expanduser() / self.org / self.repo
            get_refs = f"git -C {shlex.quote(str(local_path))} show-ref --heads"
        else:
            get_refs = f"git ls-remote --heads https://github.com/{self.org}/{self.repo}"
        try:
            # Parse get_refs output for the actual branch names
            return (line.split()[1].replace("refs/heads/", "") for line in _run(get_refs, timeout=3).split("\n"))
        except Error:
            return []
1189536
public function getCurrentRepository()
    {
        $credentials = $this->getRepositoryCredentials();
        $credentials['repository'] = $this->getRepositoryEndpoint();
        $credentials['branch'] = $this->getRepositoryBranch();

        return new RepositoryKey($credentials);
    }
908576
public function get_current_branch( $repo ) {
		$current_branch = ! empty( $this->cache['current_branch'] )
			? $this->cache['current_branch']
			: $repo->branch;

		return $current_branch;
	}
895042
public function getBranches()
    {
        static $cache = array();

        if (array_key_exists($this->path, $cache)) {
            return $cache[$this->path];
        }

        $branches = $this->getClient()->run($this, 'branch');
        $branches = explode("\n", $branches);
        $branches = array_filter(preg_replace('/[\*\s]/', '', $branches));

        if (empty($branches)) {
            return $cache[$this->path] = $branches;
        }

        // Since we've stripped whitespace, the result "* (detached from "
        // and "* (no branch)" that is displayed in detached HEAD state
        // becomes "(detachedfrom" and "(nobranch)" respectively.
        if ((0 === strpos($branches[0], '(detachedfrom')) || ('(nobranch)' === $branches[0])) {
            $branches = array_slice($branches, 1);
        }

        return $cache[$this->path] = $branches;
    }
218792
public function getCurrent()
    {
        if (is_null($this->current))
        {
            $siteView = $this->makeNewViewModel();

            $this->current = $siteView;
        }

        return $this->current;
    }
1191772
private function exists_master_branch() {

		$ret = true;
		
		// デプロイ先のマスタブランチが無い場合はfalseを返す
		if ( !file_exists( $this->options->git->repository ) ) {
			$ret = false;
		}

		return $ret;

	}
1164481
function () {
				grunt.config('release.localBranch', 'release_' + new Date().getTime());
				var command = [
					'git fetch --tags ' + grunt.config('release.remoteRepository'),
					'git fetch ' + grunt.config('release.remoteRepository'),
					'git checkout -b ' + grunt.config('release.localBranch') + ' ' +
						grunt.config('release.remoteRepository') + '/' + grunt.config('release.remoteBaseBranch')
				].join(' && ');
				grunt.log.write('Checking out new local branch based on ' + grunt.config('release.remoteBaseBranch') + ': ' + command);
				return command;
			}
163207
def current_branch
      repo.current_branch.tap {|b| raise Thor::Error.new("No explicit branch passed and current head looks detached: #{b}") if b[0] == '(' }
    end
1068341
public function key()
    {
        if ($this->current instanceof TerminalBucket) {
            return null;
        }

        /** @var KeyValueBucket $current */
        $current = $this->current;

        return $current->key();
    }
351750
def get_branch():
    
    proc = Process("git status", ["git", "status"])

    try:
        while True:
            raw_line = proc.stdout.pop()
            line = raw_line.decode('utf8').strip()
            if line.startswith("On branch "):
                return line[10:]
    finally:
        try:
            proc.join()
        except Exception:
            pass
1323986
function gitCurrentBranch() {
  return git('status --porcelain -b', stdout => {
    const status = gitUtil.extractStatus(stdout);
    return status.branch.split('...')[0];
  });
}