Skip to content

List remote branches without cloning the repo ? #81

Answered by janpecha
ahmed-bhs asked this question in Q&A
Discussion options

You must be logged in to vote

Hello!

I see two options:

1) Use empty local repository

$git = new CzProject\GitPhp\Git;
$repo = $git->init(__DIR__ . '/empty-repo');

$repo->addRemote('origin', 'https://github.com/czproject/git-php');
var_dump($repo->execute('ls-remote', '--heads', 'origin'));

2) Use CliRunner directly and run command ls-remote manually

$runner = new CzProject\GitPhp\Runners\CliRunner;
var_dump($runner->run(__DIR__, ['ls-remote', '--heads', 'https://github.com/czproject/git-php'])->getOutput());

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ahmed-bhs
Comment options

@janpecha
Comment options

Answer selected by ahmed-bhs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants