Skip to content
Skill

Get git branch

Restores full remote branch fetching in a Git repo cloned with a single-branch refspec

Get git branch is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
5
Last commit
License
MIT
Listing updated

Similar skills

About Get git branch

This skill helps when a local Git clone only shows the default branch even though the remote has more. It explains that shallow or single-branch clones narrow the fetch refspec in .git/config, so fetch never requests other branches. The agent is guided to compare the configured refspec with the branches the remote actually advertises before changing anything.

The workflow runs a few read-only checks (listing local branches, reading the origin fetch setting, querying remote heads), then switches the refspec to a wildcard pattern and runs a full fetch to bring in every remote branch. It also covers converting a shallow clone to full history, but only when the user asks for it, and lists fallback checks such as network access, permissions, pruning stale refs and other remotes.

It expects a Git repository with an origin remote and access to run git commands in a shell. The instructions are written in Chinese and the trigger phrases are Chinese as well.

When your agent uses it

诊断并修复 Git 仓库无法看到所有远程分支的问题,将受限的 fetch refspec 恢复为通配符模式, 使 git fetch 能拉取全部远程分支。当用户提及「看不到远程分支」「分支不全」 「只有 master/main」「fetch 所有分支」「shallow clone 补全分支」 「--single-branch 修复」「远程分支丢失」「获取全部分支」等关键词时使用此技能。 即使用户没有明确提到 refspec 或 shallow clone,只要意图是让仓库能看到并拉取所有远程分支, 就应触发此技能。

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (5 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the low-frequency-skill plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add ruan-cat/monorepo
/plugin install low-frequency-skill@ruan-cat-tools

Or copy only this skill to ~/.claude/skills/get-git-branch:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/get-git-branch &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/get-git-branch" ~/.claude/skills/get-git-branch &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/get-git-branch inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/get-git-branch to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/get-git-branch &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/get-git-branch" ~/.agents/skills/get-git-branch &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/get-git-branch inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/get-git-branch to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/get-git-branch &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/get-git-branch" ~/.cursor/skills/get-git-branch &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/get-git-branch inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/ruan-cat/monorepo.git --path ai-plugins/low-frequency-skill/skills/get-git-branch

Or copy the folder to ~/.gemini/skills/get-git-branch yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/get-git-branch:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/get-git-branch &&
cp -R "$tmp/ai-plugins/low-frequency-skill/skills/get-git-branch" ~/.copilot/skills/get-git-branch &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/get-git-branch inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/ruan-cat/monorepo.git

Then copy monorepo/ai-plugins/low-frequency-skill/skills/get-git-branch into your agent's skills folder as get-git-branch. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Diagnose narrowed fetch refspec
Checks the origin fetch setting and compares local branches with remote heads to confirm the cause.
Restore wildcard fetch pattern
Changes the fetch rule so Git retrieves all remote branch references again.
Fetch all remote branches
Runs a full fetch and verifies that every remote branch appears locally.
Convert shallow clone to full
Optionally unshallows a depth-limited clone when full commit history is needed.
Fallback troubleshooting steps
Lists further checks such as network, permissions, pruning and multiple remotes.

Good for

  • Make my cloned repo show all remote branches
  • Fix a shallow clone that only has main
  • Fetch every branch after a single-branch clone
  • Find out why git branch -a shows so few branches

Get git branch FAQ

What causes the missing branches?

A clone made with --depth=1 or --single-branch sets the origin fetch refspec to only the default branch, so other remote branches are not fetched.

Does the skill change my local branches or working tree?

It says changing the fetch refspec is safe and that git fetch --all does not create local branches or modify the working tree.

Will Get git branch download the full commit history?

Not by default. Unshallowing the repository only happens when the user explicitly asks for full history.

How do I install Get git branch in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/get-git-branch to use it in all your projects, or to .claude/skills/get-git-branch in one project. Or install the low-frequency-skill plugin, which includes it: /plugin marketplace add ruan-cat/monorepo, then /plugin install low-frequency-skill@ruan-cat-tools.

Does Get git branch run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Get git branch?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Get git branch?

The closest alternatives to Get git branch are Git branch cleanup, Rebase current branch, Branch, Clone ruancat repo and Rebase2main.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from ruan-cat/monorepo

  1. Works through an OpenSpec change's task list, implementing and checking off each task

    • Open source
    • 5 GitHub stars
    • Developer tools
  2. Finalizes a completed OpenSpec change, syncing its specs and moving it to the archive

    • Open source
    • 5 GitHub stars
    • Developer tools
  3. Generates all OpenSpec planning artifacts for a change in one pass

    • Open source
    • 5 GitHub stars
    • Developer tools
  4. Starts a new OpenSpec change and shows its first artifact template for review

    • Open source
    • 5 GitHub stars
    • Developer tools
  5. Checks and normalizes package.json, tsup and tsconfig setup for monorepo Node packages

    • Open source
    • 5 GitHub stars
    • Developer tools
  6. Turns incident reports and repeated failures into durable, verifiable agent skill rules

    • Open source
    • 5 GitHub stars
    • Developer tools