I forked a repository and only got the main branch: here's how I did it

Discover how to recover the missing branches in your GitHub fork: add upstream, fetch the remote branches, and checkout to work with all the branches from the original repository.

sábado, 16 de agosto de 2025 • 2 min read • Q2BSTUDIO Team

Artificial-Intelligence-

So this is what happened...

I forked a project on GitHub because I wanted to contribute to one of its features. But when I opened my fork, boom, only the main branch was there. All the other branches from the original repository had disappeared.

At first I thought something had gone wrong with the fork, but no, that's just how GitHub works.

The problem

When you fork a repository, GitHub only brings the default branch, usually main or master. It doesn't copy the other branches from the original repository. If the original repository had branches like feature/login, bugfix/style, or refactor/api, you won't see them in your fork until you bring them over manually.

The solution

Below I explain how I brought the missing branches to my fork step by step.

1 Add the original repository as a remote

git remote add upstream https://github.com/original-user/original-repo.git

Replace that URL with the one from the original repository you forked.

2 Fetch all branches from the original repository

git fetch upstream

Then you can see the remote branches with

git branch -r

You'll see entries like upstream/feature/login and upstream/bugfix/style

3 Checkout the branch you need

For example, to get feature/login

git checkout -b feature/login upstream/feature/login

With that, you'll have the branch locally.

4 Optional: push it to your fork on GitHub

If you want to work on it and push it to your forked repository

git push origin feature/login

Now it also exists on your GitHub.

Problem solved

If you ever fork a repository and wonder where the other branches are, they're not missing, you just need to bring them over manually.

About Q2BSTUDIO

At Q2BSTUDIO, we are a software development company specialized in custom applications and custom software for businesses of all sizes. We focus on comprehensive solutions that include artificial intelligence, AI for businesses, AI agents, cybersecurity, AWS and Azure cloud services, and business intelligence services. We also work with Power BI for advanced visualization and analysis and offer consulting on implementing artificial intelligence models and secure automation. Our team combines experience in custom development with cybersecurity best practices and deployments on AWS and Azure cloud services to ensure scalable and secure solutions.

If you need help integrating branches from an original repository, creating custom applications, implementing artificial intelligence solutions, or improving security and cloud infrastructure, at Q2BSTUDIO we can help you design and implement the right solution.

I hope this is useful for anyone who runs into this problem, and remember that the branches are still there, you just need to bring them over.

Keywords: custom applications, custom software, artificial intelligence, cybersecurity, AWS and Azure cloud services, business intelligence services, AI for businesses, AI agents, Power BI

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.