Fix Missing Git Branches - Bench get-app Cloned Only One Branch


You open a repository on GitHub.
You clearly see:
develop, feature-x, ui-fix, etc.You clone it locally.
Then you run:
git branch -a
And you see…
* version-16
remotes/upstream/HEAD -> upstream/version-16
remotes/upstream/version-16
That’s it.
No develop.
No feature branches.
Nothing.
It feels like Git deleted everything.
It didn’t.
Let’s understand what actually happened.
When you clone a repository, Git normally:
But some tools (like bench get-app in the Frappe ecosystem) optimize cloning to make it faster.
They tell Git:
“Download only the default branch. Ignore the rest.”
This is called a single-branch clone.
So Git is not broken. It’s just doing exactly what it was told.
Before running any fix, let’s verify.
Run this:
git config --get remote.upstream.fetch
(If your remote is named origin, replace upstream with origin.)
+refs/heads/version-16:refs/remotes/upstream/version-16
That means:
“Only fetch version-16 branch.”
This confirms you are in single-branch mode.
+refs/heads/*:refs/remotes/upstream/*
Then your config is correct, and the issue is something else.
Let’s break this down in human language.
+refs/heads/version-16:refs/remotes/upstream/version-16
It means:
| Part | Meaning |
|---|---|
refs/heads/version-16 | Only download this branch from GitHub |
: | Map from server to local |
refs/remotes/upstream/version-16 | Store it locally under upstream/version-16 |
There is no wildcard (*).
So Git ignores all other branches.
Now that we understand the problem, let’s fix it.
We need to tell Git:
“Stop being specific. Fetch ALL branches.”
Run:
git config remote.upstream.fetch "+refs/heads/*:refs/remotes/upstream/*"
What changed?
We replaced:
version-16
With:
*
That star means:
“Everything.”
Updating config doesn’t download anything yet.
Now run:
git fetch --all
Now Git will download all remote branches.
You should see output like:
* [new branch] develop -> upstream/develop
* [new branch] feature-login -> upstream/feature-login
* [new branch] ui-fix -> upstream/ui-fix
Run:
git branch -a
Now you’ll see:
remotes/upstream/develop
remotes/upstream/feature-login
remotes/upstream/ui-fix
You can now create a local branch:
git checkout -b develop upstream/develop
And you’re good to go.
Tools like:
bench get-appUse optimized cloning like:
git clone --single-branch
This makes cloning faster and lighter — especially for large repos.
But when you need another branch, you suddenly hit this wall.
You might have seen another issue where Git downloads only limited commit history.
That’s called a shallow clone (--depth 1).
That is a different problem.
This article fixes missing branches. Shallow clone fixes missing history.
Two different layers of Git.
Think of a Git repository like this:
A shallow clone hides part of the story.
A single-branch clone hides the other bookmarks.
Now you know how to restore the bookmarks.
If git branch -a shows only one branch:
Check fetch config:
git config --get remote.upstream.fetch
If it targets a single branch, update it:
git config remote.upstream.fetch "+refs/heads/*:refs/remotes/upstream/*"
Fetch:
git fetch --all
Done.
Learn how to add Stripe and Razorpay subscription billing to a custom Frappe app — whitelisted APIs, webhook signature verification, and scheduler-based renewals.
Stop fighting the built-in resource API for complex business logic. Here's how to expose your own Python functions as clean, secure REST endpoints in Frappe
A practical Frappe tutorial for fixing wrong workspace redirects using role-to-route mapping, capture-phase click handling, and a reusable Desk JavaScript file.