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 7803535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:36:51+00:00 2026-06-02T01:36:51+00:00

This is my understanding of Git:- If I clone a repository then I initially

  • 0

This is my understanding of Git:-

If I clone a repository then I initially only get a copy of the master branch. I can then indicate that I want to track a remote branch using git checkout with the -b flag. This works as expected.

So my question is how do you get Git to tell you this information. If I type git branch -a then it shows me a mixed list of all the branches e.g.

* master
  mybranch
  remotes/origin/master
  remotes/origin/mybranch

What I want to know is other than maintaining the same name, how can I tell what local branches are tracking what remote ones?

Thanks.

  • 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-02T01:36:53+00:00Added an answer on June 2, 2026 at 1:36 am

    If I clone a repository then I initially only get a copy of the master branch. I can then indicate that I want to track a remote branch using git checkout with the -b flag. This works as expected.

    In fact, git checkout -b ... is what you use to create a new branch. If you simply want to check out a branch that already exists in the remote, you don’t need -b. For example, here I’m creating a local branch that tracks remotes/origin/folder-hack:

    $ git checkout folder-hack
    Branch folder-hack set up to track remote branch folder-hack from amdragon.
    Switched to a new branch 'folder-hack'
    

    What I want to know is other than maintaining the same name, how can I tell what local branches are tracking what remote ones?

    Each branch has a corresponding configuration in .git/config. You can find the remote associated with a branch by looking at branch.<BRANCHNAME>.remote, and you can find the name of the remote branch by looking at branch.<BRANCHNAME>.merge. So, from my previous example:

    $ git config --get branch.folder-hack.remote
    amdragon
    $ git config --get branch.folder-hack.merge
    refs/heads/folder-hack
    

    You can just run git config --list and look at the branch... lines.

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

Sidebar

Related Questions

If I'm understanding this correctly about garbage collection in .NET CLR, then GC occurs
When we define custom metadata for the components, it is my understanding that this
This question is related to my problem in understanding rebase, branch and merge ,
Possible Duplicate: git push error '[remote rejected] master -> master (branch is currently checked
I have a development clone and a live clone of a git repository, pushing
It's possible that I'm not really understanding how git works here, but I have
I need help in understanding git rebase for this situation. I checked out a
Use case: -Visual Studio is open -Master branch is clean (confirmed with git status)
I have a GIT clone of an SVN repository. Based on the CAVEATS section
I have a remote git repository where I have a tag (tag-1) that is

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.