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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:01:48+00:00 2026-05-24T08:01:48+00:00

I am trying to figure out what branch will be fetched if I do

  • 0

I am trying to figure out what branch will be fetched if I do git fetch in the current branch, and how can I change that (by some variant of git remote or editing .git/config file).

From what remote branch git pull fetches the contents? Is it the same from which git fetch fetches the contents? Is there a git command which can show me all this information?

  • 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-05-24T08:01:49+00:00Added an answer on May 24, 2026 at 8:01 am

    To set up the tracked remote branch for a local branch use

    git branch --set-upstream <local_branch> <remote_branch>
    

    So, if you want your local master to track origin/master, type

    git branch --set-upstream master origin/master
    

    However, git fetch fetches all branches of the configured remote.

    If you have multiple remotes (e.g. origin and other),

    git fetch other
    

    will fetch the remote other while

    git fetch origin
    

    will fetch origin.

    To find out which remote branch is being tracked, open .git/config and search for an entry like

    [branch "mybranch"]
      remote = <remote_name>
      merge = <remote_branch>
    

    This tells you that your local branch mybranch has <remote_name> as configured remote and that it tracks <remote_branch> on <remote_name>.

    Which branches are fetched from a remote and how they are called in your local repo is defined in the following section of .git/config:

    [remote "origin"]
      fetch=+refs/heads/*:refs/remotes/origin/*
      url=<url_of_origin>
    

    This tells you that the branches stored under refs/heads of your origin get fetched and get stored under refs/remotes/origin/ in your local repo.

    If you are on mybranch and type git fetch, the revisions of <remote_name> (specified in the [remote <remote_name>] section) will be fetched. If you type git pull, after fetching the revisions of <remote_name> the branch <remote_branch> of <remote_name> will be merged into mybranch.

    Additional information can be found on the man pages of git branch, git fetch and git pull.

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

Sidebar

Related Questions

I'm trying to figure out how to work git filter-branch and I need help
Trying to figure out how I can do this properly. The print_r looks like
I'm (still) trying to figure out how to change state images of a treeview
I've been trying to figure this one out by reading the git-svn man-page but
I'm trying to figure out how can I differentiate jenkins builds between users. My
So I'm trying to create a remote branch so I can push updates to
I'm trying to figure out the revision in the trunk when a branch was
Trying to figure out on how can i disable the reordering of table columns
Trying to figure out an equation to get the current group a page would
Trying to figure out the best way to have a templated brochure that creates

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.