diff --git a/src/GitRepository.php b/src/GitRepository.php index 66d67b2..01898e7 100644 --- a/src/GitRepository.php +++ b/src/GitRepository.php @@ -542,6 +542,36 @@ public function setRemoteUrl($name, $url, array $params = NULL) } + /** + * Get remote repository URL + * @return string + * @throws GitException + */ + public function getRemoteUrl() + { + $this->begin(); + $remoteUrl = exec('git remote get-url origin'); + $this->end(); + + return $remoteUrl; + } + + + /** + * Get the default branch name + * @return string + * @throws GitException + */ + public function getDefaultBranchName($remote = false) + { + $this->begin(); + $branchName = exec('git symbolic-ref --short ' . ($remote ? 'refs/remotes/origin/HEAD' : 'HEAD')); + $this->end(); + + return $branchName; + } + + /** * @param string|string[] * @return string[] returns output