list_remote_branches
Lists all branches in a remote repository without cloning. Use it to identify the default branch before cloning to avoid failures.
Instructions
Discover all available branches in a remote repository without cloning.
CRITICAL USE CASE: Many repositories use "master", "develop", or other names instead
of "main" as their default branch. Use this tool BEFORE clone_repo to discover the
actual default branch name and avoid clone failures.
This tool uses git ls-remote --heads to query the remote repository, which is fast
and does not require cloning the entire repository.
Args:
repo_url (str): Remote repository URL (e.g., https://github.com/user/repo)
Returns:
dict: Response with format:
{
"status": "success" | "error",
"repo_url": str, # Repository URL queried
"remote_branches": [str], # List of branch names (e.g., ["main", "develop", "feature-x"])
"total_remote": int, # Total number of branches found
"error": str # (Only on error) Error message
}
Common Default Branch Names to Look For:
- "main" (modern GitHub default)
- "master" (traditional Git default)
- "develop" or "development" (common for dev workflows)
- Check repository documentation if unclear
Typical Workflow:
1. Discover branches: branches = list_remote_branches(url)
2. Identify default branch from branches["remote_branches"]
- Look for "main", "master", or "develop"
- If unsure, check the repository's web page
3. Clone with correct branch: clone_repo(url, branch=identified_branch)
Note:
- Fast operation, does not clone the repository
- Requires network access to the remote repository
- Works with any Git repository (GitHub, GitLab, Bitbucket, etc.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_url | Yes |