Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7932429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:01:01+00:00 2026-06-03T21:01:01+00:00

When git clone some repository then it retrieves all branches from it: git clone

  • 0

When git clone some repository then it retrieves all branches from it:

git clone https://github.com/android/platform_build.git build1
cd build1/ && git branch -a && cd ..

then, when I use build1 as a mirror and clone it, I do not see all its remote branches (I see only build1‘s local master branch)

git clone build1 build2
cd build2 && git branch -a && cd ..

How can I checkout remote of remote branches ?

I know that I can checkout all remote branches in build1 mirror with command

cd build1 && for remote in `git branch -r `; do git branch --track $remote; done

Track all remote git branches as local branches
but what if I do not have access to build1 directory ?

Also, there is git ls-remote origin command which shows all remote refs, but is there any elegant way to checkout those remote of remote branches ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:01:02+00:00Added an answer on June 3, 2026 at 9:01 pm

    After you clone build1 to build2, build1 is build2‘s origin, and build2 knows nothing about https://github.com/android/platform_build.git , which is where the “remote” branches live. One solution may be to add https://github.com/android/platform_build.git as a remote in the configuration of build2. To add a remote called github:

    git remote add github https://github.com/android/platform_build.git
    

    Then run a fetch to get the remote branches:

    git fetch github
    

    Now, when you run git branch -a you should see branches prefixed with remotes/github/ that correspond with those prefixed with remotes/origin in build1.

    On the other hand, build2 should have a remote branch for each local branch in build1, including those that are tracking remote branches from build1‘s perspective. For example, if there is a branch named foo on github, it will show up as remotes/origin/foo in build1. If you set up a local branch to track that remote branch in build1 also called foo, then build2 should have a remotes/origin/foo as well. Then, when foo is updated in build1 by fetching/merging changes from github’s foo, those changes should show up in build2 after a fetch/pull.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cloned a git repository from GitHub, made some changes and some commits; I
I clone my source using git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git w/ . Then I specify a
(Using Vista)I'm trying to clone an app from my GitHub Repository and push it
I have a public repository at github.com with 2 branches : master and test
I am making changes to some file in my local git repository and then
I forked a project in github and then did a git clone on this
I created a repository with git-svn from a big svn repository (git svn clone).
I would like to clone a project from a Git server and then perform
I did a: git clone http://github/anotheruser/something.git my-space and made some changes. Is there anyway
I often use git from Terminal on Mac to download some repositories and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.