File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,25 @@ public function list_branches($keep_asterisk = false) {
388388 return $ branchArray ;
389389 }
390390
391+ /**
392+ * Lists remote branches (using `git branch -r`).
393+ *
394+ * Also strips out the HEAD reference (e.g. "origin/HEAD -> origin/master").
395+ *
396+ * @access public
397+ * @return array
398+ */
399+ public function list_remote_branches () {
400+ $ branchArray = explode ("\n" , $ this ->run ("branch -r " ));
401+ foreach ($ branchArray as $ i => &$ branch ) {
402+ $ branch = trim ($ branch );
403+ if ($ branch == "" || strpos ($ branch , 'HEAD -> ' ) !== false ) {
404+ unset($ branchArray [$ i ]);
405+ }
406+ }
407+ return $ branchArray ;
408+ }
409+
391410 /**
392411 * Returns name of active branch
393412 *
@@ -507,4 +526,4 @@ public function get_description() {
507526
508527}
509528
510- /* End of file */
529+ /* End of file */
You can’t perform that action at this time.
0 commit comments