Skip to content

Adds feature to check if a branch name exists in a repository without… #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2023

Conversation

hostep
Copy link
Contributor

@hostep hostep commented May 8, 2023

… cloning it.


I have a case where I want to verify before cloning a git repository that a branch name exists on the remote repo.
This adds such a feature.

It works with the command git ls-remote --heads {repo-url} {branch-name}
If the branch name is found in the output, we can assume the branch exists on the remote.

For example:

$ git ls-remote --heads https://github.com/gitonomy/foobar master
7e9ba14939b0ce67ab95d83e03bd64710db91ef4	refs/heads/master

$ git ls-remote --heads https://github.com/gitonomy/foobar invalid-branch-name

Copy link
Member

@lyrixx lyrixx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍🏼

@lyrixx lyrixx merged commit 9fea656 into gitonomy:1.3 May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants